Syntax
| WillExecute Source, CursorType, LockType, Options, adStatus, pCommand, pRecordset, pConnection
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description
| This event is called before a pending command is executed.It allows you to change the execution parameters.
The WillExecute event can be fired just before a Command Execute, Connection Execute, or Recordset Open method starts to execute. This event is one of two command execution management events that can be called. The other event is ExecuteComplete.
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. Future calls to the event subroutine can be cancelled by setting the adStatus parameter to be the adStatusUnwantedEvent constant (see table below) before the event returns.
There are eight parameters that are passed to this event.
CursorTypeEnum constants
LockTypeEnum Constants
CommandTypeEnum Constants
ExecuteOptionEnum Constants
EventStatusEnum Constants
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See Also
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Example
| ' Use the WithEvents keyword to designate that events
' can be handled by this Connection object
Dim WithEvents objConn As ADODB.Connection
' Note how the object name, objConn, is incorporated into the event Sub name
Private Sub objConn_WillExecute( Source As String, _
CursorType As ADODB.CursorTypeEnum, _
LockType As ADODB.LockTypeEnum, _
Options As Long _
adStatus As ADODB.EventStatusEnum, _
ByVal pCommand As ADODB.Command , _
ByVal pRecordset As ADODB.Recordset , _
ByVal pConnection As ADODB.Connection )
' place any code you desire here, for example
If LockType = adLockReadOnly Then
Print "The Lock Type is read-only"
End If
End Sub
|