Syntax
| WillChangeRecordset(adReason, adStatus, pRecordset)
| |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| Called before any pending changes are made to the Recordset.
The WillChangeRecordset event can be fired before any pending change occurs in the contents of a Recordset. This can be due to a pending call to either the Open or Requery methods of the Recordset object.
In contrast, the RecordsetChangeComplete event can be fired after a change occurs in the Recordset.
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.
EventReasonEnum Constants
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_WillChangeRecordset( adReason As ADODB.EventReasonEnum, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset )
' place any code you desire here, for example
If adReason = adRsnResynch Then
adStatus = adStatusCancel
End If
End Sub
|