Seek - method of the AdoRecordset object
Description:
The method searches the index of the
AdoRecordset object to find a record that matches the values specified in the
keyvalues parameter.
If there is a match, then the current record will be the record specified by the
seekoption parameter.
If there is no match, then the current record will be placed to the end of the
AdoRecordset object.
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.
Syntax:
Object Seek(Variant keyvalues, Long seekoption)
Parameters:
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 key values.
2 - adSeekLastEQ Seeks the last key equal to key values.
4 - adSeekAfterEQ Seeks either a key equal to key values or just after where that match would have occurred.
8 - adSeekAfter Seeks a key just after where a match with key values would have occurred.
16 - adSeekBeforeEQ Seeks either a key equal to key values or just before where that match would have occurred.
32 - adSeekBefore Seeks a key just before where a match with key values would have occurred. |
---|
Example:
JavaScriptVBScriptSelect and copy to clipboard
oRs.Seek(Val, 1);
oRs.Seek Val, 1