ADO Move Method

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO Move Method

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.

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.

Syntax

objRecordset.Move numRecords,start

 

Parameter

Description

numRecords Required. Specifies how many records the record pointer will move.

Example: If this parameter is set to 3, the record pointer moves 3 records forward.

Example: If this parameter is set to -3, the record pointer moves 3 records backward

start Optional. Where to start. Can be a bookmark or a BookmarkEnum value

Example


varBookMark = objRecordset.Bookmark
objRecorset.Move lngMoveNum
If objRecordset.EOF = True
   objRecordset.Bookmark = varBookMark
End If
 

BookmarkEnum

Constant Value

Description

adBookmarkCurrent 0 Starts at the current record
adBookmarkFirst 1 Starts at the first record
adBookmarkLast 2 Starts at the last record