From RAD Studio API Documentation
Jump to: navigation, search


procedure GotoNearest;


void __fastcall GotoNearest();


Type Visibility Source Unit Parent
Bde.DBTables TTable


Moves the cursor to the record that most closely matches the current key.

Call GotoNearest to position the cursor on the record that is either the exact record specified by the current key values in the key buffer, or on the first record whose values exceed those specified. If there are no records that match or exceed the specified criteria, GotoNearest positions the cursor on the last record in the table.

Before calling GotoNearest, an application must specify key values by calling SetKey or EditKey to put the dataset is dsSetKey state, and then use FieldByName to populate the key buffer property with search values.

For Paradox and dBASE tables, the key must always be an index, which can be specified in the IndexName property. If IndexName is empty, GotoNearest uses the table's primary index. GotoNearest works with dBASE expression indexes.

For SQL tables, the key may correspond to a specified index in IndexName, or to a list of field names in the IndexFieldNames property.

Note: KeyExclusive determines which records are considered part of a search range.

See Also