Recordset.Move

Move the position of the current record in a Recordset object.

Syntax
      expression.Move(Rows, StartBookmark)

Key
   Rows          The number of rows the position will move.
                 If rows is greater than 0, the position is
                 moved forward (toward the end of the file). 
                 If rows is less than 0, the position is moved
                 backward (toward the beginning of the file).
      
   StartBookmark A bookmark. Begin the move relative to this
                 bookmark instead of the current record.

The Move methods move from record to record without applying a condition.

Attemting to move past either BOF or EOF will raise an error, you can trap this error with If .BOF Then

On a forward-only-type Recordset object, the rows argument must be a positive integer and bookmarks aren't allowed. This means you can only move forward.

To make the first, last, next, or previous record in a Recordset the current record, use either the MoveFirst, MoveLast, MoveNext, or MovePrevious method.

Example

Dim db As Database
Dim rst As Recordset

Set dbs = OpenDatabase("Northwind.mdb")
Set rst = dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
      
With rst
   ' Populate recordset.
.MoveLast
.MoveFirst ' Move to the 10,000th record .Move 10000 .Close End With

“Twenty years from now, you will be more disappointed by the things you didn't do than by the ones you did do. So throw off the bowlines, sail away from the safe harbour. Catch the trade winds in your sails. Explore. Dream. Discover” ~ Mark Twain

Related:

FindFirst/Last/Next/Previous Record
MoveFirst/Last/Next/Previous Record
RecordSet.Close - Close a recordset
Update - Save a recordset
CancelUpdate - Cancel recordset changes


© Copyright SS64.com 1999-2013
Some rights reserved