Partager via


CDaoRecordset::Move

Call this member function to position the recordset lRows records from the current record.

virtual void Move( 
   long lRows  
);

Parameters

  • lRows
    The number of records to move forward or backward. Positive values move forward, toward the end of the recordset. Negative values move backward, toward the beginning.

Remarks

You can move forward or backward. Move( 1 ) is equivalent to MoveNext, and Move( -1 ) is equivalent to MovePrev.

Warning

Calling any of the Move functions throws an exception if the recordset has no records. In general, call both IsBOF and IsEOF before a Move operation to determine whether the recordset has any records. After you call Open or Requery, call either IsBOF or IsEOF.

Note

If you have scrolled past the beginning or end of the recordset (IsBOF or IsEOF returns nonzero), a call to Move throws a CDaoException.

Note

If you call any of the Move functions while the current record is being updated or added, the updates are lost without warning.

When you call Move on a forward-only scrolling snapshot, the lRows parameter must be a positive integer and bookmarks are not allowed, so you can move forward only.

To make the first, last, next, or previous record in a recordset the current record, call the MoveFirst, MoveLast, MoveNext, or MovePrev member function.

For related information, see the topics "Move Method" and "MoveFirst, MoveLast, MoveNext, MovePrevious Methods" in DAO Help.

Requirements

Header: afxdao.h

See Also

Reference

CDaoRecordset Class

Hierarchy Chart

CDaoRecordset::MoveFirst

CDaoRecordset::MoveLast

CDaoRecordset::MoveNext

CDaoRecordset::MovePrev