Find Method
Index Method
METHOD: Recordset::Seek
recordsetobject.
Seek
KeyValues, SeekOption
The
Seek
method uses the provider to search using indexes to find a
Record
in a
Recordset
that matches the values specified in the
KeyValues
parameter. If a match occurs, the current record pointer will point to the matching record or where specified by the
SeekOption
parameter. If no match occurs, the current record pointer will be placed at the end of the
Recordset
.
Very few providers support this method. The provider must support this method and the use of indexes on the
Recordset
(see the
Index
property). This method can only be used with server-side cursors.
There are two mandatory parameters.
The
KeyValues
parameter is a variant array that contains one or more values to compare against the values in each corresponding column.
The
SeekOption
parameter is one of the
SeekEnum
constants that specify how to conduct the search. The default is
adSeekFirstEQ
.
PositionEnum Constants
Constant
Value
Description
adSeekAfter
8
Find a key just after the match to
KeyValues
Find the last key equal to
KeyValues
adSeekAfterEQ
4
Find a key equal to
KeyValues
or just after the match
adSeekBefore
32
Find a key just before the match to
KeyValues
adSeekBeforeEQ
16
Find a key equal to
KeyValues
or just before the match
adSeekFirstEQ
1
Find the first key equal to
KeyValues
adSeekLastEQ
2
Code (VBScript):
strIndex = "BigCats"
...
If objRecordset.Supports(adSeek) = True Then
objRecordset.Index = strIndex
objRecordset.
Seek
"Jaguar", adSeekLastEQ
End If
If objRecordset.EOF Then
MsgBox "Record Not Found", vbOK
End If
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information