Seek Method (Professional Edition Only)
See Also Example
Locates a record in an indexed table that meets the specified criteria for the current index and makes it the current record .
table.Seek comparison, key1, key2...
The Seek method uses these parts:
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 as the corresponding field in the current index. For example, if the current index refers to a numeric key field (such as Employee ID), key1 must be a numeric expression . Similarly, if the current index refers to a Text field (such as Last Name), key1 must be a string expression .
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.