Move Method Example (MDB)

The following example uses the Move method to move forward two rows in a Recordset object:

Sub MoveForward()
    Dim dbs As Database, rst As Recordset
    Dim strCriteria As String

    ' Return reference to current database.
    Set dbs = CurrentDb
    ' Open dynaset-type Recordset object.
    Set rst = dbs.OpenRecordset("SELECT * FROM Orders " _
        & "ORDER BY ShipCountry;")
    rst.MoveLast
    rst.MoveFirst
    ' Check number of records in Recordset object.
    If rst.RecordCount > 2 Then
        ' Move forward two rows.
        rst.Move 2
        Debug.Print rst!ShipCountry
    End If
    rst.Close
    Set dbs = Nothing
End Sub