Seek Method (Professional Edition Only)

See AlsolanSeekMethodSee                 ExamplelanSeekMethodX>Low

Description

Locates a record in an indexed table3N276AP that meets the specified criteria for the current index1UO70XX and makes it the current record1BNJB8X.

Syntax

table.Seek comparison, key1, key2...

Remarks

The Seek method uses these parts:

Part                 Description

 

table                 Object variableZ3R9Q5 identifying an open Table.

comparison       One of the following string expressions1330R89:  <,  <=,  =,  >=,  >,  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 type17F82T4 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 expression71RISN. Similarly, if the current index refers to a Text field (such as Last Name), key1 must be a string expression1330R89.

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.