ADO » Recordset » MovePrevious

Syntax:
recordsetobject.MovePrevious

Moves the position of the current record pointer back to the previous record.

The MovePrevious method is called to move to the previous record in the specified Recordset object.

If the Recordset does not support bookmarks and is using a forward only cursor, then an error will be generated when you call this method.

If you are at the first record, calling this method will put you at BOF and the BOF property will be set to True. If you are at BOF and call this method, an error will be generated.

This is one of four methods belonging to the Recordset object that allow you to navigate or move through a data record. The other three are, MoveFirst, MoveLast, and MoveNext.

Examples

Code:
objRecorset.MovePrevious
If objRecordset.BOF = True
   objRecordset.MoveFirst
   MsgBox "At First Record", vbOK
End If
Code:
Sub MoveFirst_OnClick
   objDataControl.objRecordset.MoveFirst
End Sub

Sub MoveLast_OnClick
   objDataControl.objRecordset.MoveLast
End Sub

Sub MoveNext_OnClick
   If objRecordset.EOF = False Then
      objDataControl.objRecordset.MoveNext
   End If
End Sub

Sub MovePrevious_OnClick
   If objRecordset.BOF = False Then
      objDataControl.objRecordset.MovePrevious
   End If
End Sub
Explanation:

RDS allows the Recordset object to be bound to an HTML tag so that the data can be displayed on a web page. You can use four buttons on a Web page to navigate through a displayed recordset. When a button is clicked, a subroutine containing one of the four move methods is called.

See Also: