Repeating or Extending a Search

From RAD Studio
Jump to: navigation, search

Go Up to Using Indexes to Search for Records

Each time you call SetKey or FindKey, the method clears any previous values in the Fields property. If you want to repeat a search using previously set fields, or you want to add to the fields used in a search, call EditKey in place of SetKey and FindKey.

For example, suppose you have already executed a search of the Employee table based on the City field of the "CityIndex" index. Suppose further that "CityIndex" includes both the City and Company fields. To find a record with a specified company name in a specified city, use the following code:

Employee.KeyFieldCount := 2;
Employee['Company'] := Edit2.Text;

Employee->KeyFieldCount = 2;
Employee->FieldValues["Company"] = Variant(Edit2->Text);

See Also