METHOD:  Recordset::Move

string = recordsetobject.Move (NumRecords, Start )

The Move method is called to move the position of the current record pointer. As required, the current cache of records is automatically updated in concert with the move. If the current record has been modified and an Update has not been performed, then when you call MoveFirst, there will also be an implicit call to Update for the current record. If you do not wish to keep the changes to the current record, then you should call CancelUpdate before you call MoveFirst.

There is one mandatory parameter and one optional parameter.

The NumRecords parameter is a long value that specifies how many records the current record pointer will move. A value of zero does nothing.

A positive number moves the current record pointer forward. If a forward move would take you past the last record, then the pointer is set to EOF and the EOF property is set to True.

A negative number moves the current record pointer backwards. If a backward move would take you to before the first record, then the pointer is set to BOF and the BOF property is set to True.

If a Recordset is using a forward moving cursor, then you can only go backwards as far as the first record in the current cache of records. Therefore, how far you can move backwards will be determined by the CacheSize property. However, you can go forward to as far as the last record or EOF.

The optional Start parameter is a variant that is either a bookmark or one of the BookmarkEnum constants that indicates the starting position for the search. The default is to start at the current record.

BookmarkEnum Constants
 
Constant Value Description
adBookmarkCurrent 0 Default, start search at current record
adBookmarkFirst 1 Start search at first record
adBookmarkLast 2 Start search at last record

 
Code (VBScript):
varBkMrk = objRecordset.Bookmark
objRecorset.Move lngMoveNum
If objRecordset.EOF = True
   objRecordset.Bookmark = varBkMrk
End If

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information