WillMove and MoveComplete Events (ADO)

The WillMove event is called before a pending operation changes the current position in the Recordset. The MoveComplete event is called after the current position in the Recordset changes.

Syntax

  
WillMove adReason, adStatus, pRecordset  
MoveComplete adReason, pError, adStatus, pRecordset  

Parameters

adReason
An EventReasonEnum value that specifies the reason for this event. Its value can be adRsnMoveFirst, adRsnMoveLast, adRsnMoveNext, adRsnMovePrevious, adRsnMove, or adRsnRequery.

pError
An Error object. It describes the error that occurred if the value of adStatus is adStatusErrorsOccurred; otherwise the parameter is not set.

adStatus
An EventStatusEnum status value.

When WillMove is called, this parameter is set to adStatusOK if the operation that caused the event was successful. It is set to adStatusCantDeny if this event cannot request cancellation of the pending operation.

When MoveComplete is called, this parameter is set to adStatusOK if the operation that caused the event was successful, or to adStatusErrorsOccurred if the operation failed.

Before WillMove returns, set this parameter to adStatusCancel to request cancellation of the pending operation, or set this parameter to adStatusUnwantedEvent to prevent subsequent notifications.

Before MoveComplete returns, set this parameter to adStatusUnwantedEvent to prevent subsequent notifications.

pRecordset
A Recordset object. The Recordset for which this event occurred.

Remarks

A WillMove or MoveComplete event may occur due to the following Recordset operations: Open, Move, MoveFirst, MoveLast, MoveNext, MovePrevious, AddNew, and Requery. These events may occur because of the following properties: Filter, Index, Bookmark, AbsolutePage, and AbsolutePosition. These events also occur if a child Recordset has Recordset events connected and the parent Recordset is moved.

You must set the adStatus parameter to adStatusUnwantedEvent for each possible adReason value in order to completely stop event notification for any event that includes an adReason parameter.

See Also

ADO Events Model Example (VC++)
ADO Event Handler Summary
Recordset Object (ADO)