Seek - method of the AdoRecordset object
The method searches the index of the AdoRecordset
object to find a record that matches the values specified in the keyvalues
If there is a match, then the current record will be the record specified by the seekoption
If there is no match, then the current record will be placed at the end of the AdoRecordset
To use this method, the provider must support this method and the use of indexes in the AdoRecordset
object (the Index
property). Use the Supports
method to determine whether the provider supports seek and indexes.
Set the Index
property to the desired index before executing this method.
This method can only be used with server-side cursors (not supported if the CursorLocation
property value is adUseClient
). This method can be used only if the AdoRecordset
object was opened with the CommandTypeEnum
value of adCmdTableDirect
Object Seek(Variant keyvalues, Long seekoption)
|keyvalues||(Variant) An array of values to compare with the values in each column.|
|seekoption||(Long) The SeekEnum value that specifies the type of seek.
1 - adSeekFirstEQ Seeks the first key equal to keyvalues.
2 - adSeekLastEQ Seeks the last key equal to keyvalues.
4 - adSeekAfterEQ Seeks either a key equal to keyvalues or just after where that match would have occurred.
8 - adSeekAfter Seeks a key just after where a match with keyvalues would have occurred.
16 - adSeekBeforeEQ Seeks either a key equal to keyvalues or just before where that match would have occurred.
32 - adSeekBefore Seeks a key just before where a match with keyvalues would have occurred.