Seek Method (Professional Edition Only)
See Also Example
Description
Locates a record in an indexed table
Syntax
table.Seek comparison, key1, key2...
Remarks
The Seek method uses these parts:
Part Description
table Object variable identifying an open Table.
comparison One of the following string expressions : <, <=, =, >=, >, or <>.
key1, key2... One value for each field in the table's current index.
Seek searches through the specified Table using the current index and locates the first record satisfying the criteria specified by comparison and the key values (key1, key2...), and makes it the current record.
You must set the current index with the Index property before you use Seek. If the index identifies a nonunique key field, Seek locates the first record satisfying the criteria.
When comparison is =, >=, >, or <>, Seek starts at the beginning of the index and searches forward. When comparison is <= or <, Seek starts at the end of the index and searches backward.
The value of each key value must be of the same field data type
There doesn't have to be a current record when you use Seek.
You can use the Indexes collection to get names of existing indexes.
If table doesn't refer to an open table, or if there is no current index, an error occurs.
Use the Move methods, such as MoveFirst, to move between all records in a recordset. In a Dynaset or Snapshot, use the Find methods, such as FindFirst, to move between records that meet specific conditions.
Note Always inspect the value of the NoMatch property of the recordset to determine whether the Seek method has succeeded. If it fails, NoMatch is True and the current record is unchanged.