Syntax
| WillMove(adReason, adStatus, pRecordset)
| ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| Called before a pending operation can change the current position.
The WillMove event can be fired before the current position inside the Recordset will be changed by an operation that involves a call to the AddNew, Move, MoveFirst, MoveLast, MoveNext, MovePrevious, Open, or the Requery methods or to the AbsolutePage, Bookmark, Filter, or Index properties. This event can be triggered for both child and parent Recordset objects.
In contrast, the MoveComplete event can be fired after a position change occurs in the Recordset involving the same methods.
An event is simply a subroutine that can be called automatically after a specific operation has occurred. This subroutine can contain any code that you need to run when the event occurs. The subroutine will only be called if it is included in your code.
There are three parameters passed to this event.
EventStatusEnum Constants
| ||||||||||||||||||||||||||
See Also
| |||||||||||||||||||||||||||
Example
| ' Use the WithEvents keyword to designate that events
' can be handled by this Recordset object
Dim WithEvents objRecSet As ADODB.Recordset
' Note how the object name, objRecSet, is incorporated into the event Sub name
Private Sub objRecSet_WillMove( adReason As ADODB.EventReasonEnum, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset )
' place any code you desire here, for example
If adReason = adRsnRequery Then
adStatus = adStatusCancel
End If
End Sub
|