Name

Recordset.Index Property — (Versions 2.1, 2.5, 2.6)

Synopsis

recordset.Index = index

The Index property sets the current index for a given recordset.

Datatype

String

Description

The Index property is both read- and write-enabled. However, it cannot be set within a WillRecordsetChange or RecordsetChangeComplete event or during an asynchronous execution.

The Index property is used in conjunction with the Seek method to take advantage of the underlying table’s indexed structure (as compared to the Find method, which operates sequentially).

The position of the record pointer may change when the Index is set (changing the AbsolutePosition property value). In addition, the following events occur: WillRecordsetChange, RecordsetChangeComplete, WillMove, and MoveComplete.

If the LockType property is set to adLockPessimistic or adLockOptimistic, then the UpdateBatch method is called releasing any filter that may be applied. In addition, the record pointer is moved to the first record in the indexed recordset.

Note

Not all providers support indexes; therefore, they do not all support the Index property.

See Also

CursorOptionEnum Enumeration, Recordset.MoveComplete Event, Recordset.RecordsetChangeComplete Event, Recordset.Seek Method, Recordset.UpdateBatch Method, Recordset.WillMove Event, Recordset.WillRecordsetChange Event, Recordset.Supports Method

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.