Move Method

The Move method on a Recordset object moves the position of the current record in a Recordset object.

recordset.Move NumRecords, Start
 

Parameters

NumRecords
This parameter specifies a signed Long expression specifying the number of records the current record position moves.
Start
This optional parameter specifies the starting location for the record from which the Move operation should begin, which can be a bookmark or an enumeration indicating the current, first, or last record in a Recordset object. This argument is a Variant and can be either a bookmark or one of the following enumerated values for BookmarkEnum:
Enumeration Value Description
adBookmarkCurrent 0 The current record.
adBookmarkFirst 1 The first record.
adBookmarkLast 2 The last record.

This optional argument defaults to adBookmarkCurrent.

Return Values

None.

Remarks

The Move method is supported on all Recordset objects.

If the NumRecords parameter is greater than zero, the current record position moves forward (toward the end of the recordset). If NumRecords is less than zero, the current record position moves backward (toward the beginning of the recordset).

If the Move method would move the current record position to a point before the first record, ADO sets the current record to the position before the first record in the recordset (the BOF property is set to True). An attempt to move backward when the BOF property is already True generates an error.

If the Move call would move the current record position to a point after the last record, ADO sets the current record to the position after the last record in the recordset (the EOF property is set to True). An attempt to move forward when the EOF property is already True generates an error.

Invoking the Move method from an empty Recordset object generates an error.

If the Start parameter is specified, the move is relative to the record with this bookmark assuming the Recordset object supports bookmarks. If not specified, the move is relative to the current record.

If the CacheSize property is set to greater than 1 to locally cache records from the provider, passing a NumRecords value that moves the current record position outside of the current group of cached records forces ADO to retrieve a new group of records starting from the destination record. The CacheSize property determines the size of the newly retrieved group, and the destination record is the first record retrieved.

If the Recordset object is forward-only, a user can still pass a NumRecords value less than zero as long as the destination is within the current set of cached records. If the Move method call would move the current record position to a record before the first cached record, an error occurs. Thus, you can use a record cache that supports full scrolling over a provider that only supports forward scrolling. Because cached records are loaded into memory, you should avoid caching more records than necessary. Even if a forward-only Recordset object supports backward moves in this way, calling the MovePrevious method on any forward-only Recordset object still generates an error.