ADODB Object
 
Syntax
 
BeginTransComplete TransActionLevel, pError, adStatus, pConnection
 
Description
After a BeginTrans operation has finished executing,you can call this event to trigger other operations.
 
The BeginTransComplete event can be fired after a BeginTrans method call is completed. This event is one of three transaction management events that can be called. The other two are CommitTransComplete and RollbackTransComplete.
 
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 four parameters that are passed to this event.
 
Parameter
Description
TransactionLevel
The TransactionLevel parameter is a long value that is the transaction level of the BeginTrans method call that triggered the event.
pError
The pError parameter is an Error object that contains information about the occurrence of any errors and/or warnings. This parameter requires that the adStatus parameter be set to the adStatusErrorsOccurred constant, otherwise the Error object is not created.
adStatus
The adStatus parameter is one of the EventStatusEnum constants and defines the status of the event. If the BeginTrans operation that causes the event to fire was successful, this parameter is set to adStatusOK. If the BeginTrans operation was not successful, this parameter is set to adStatusErrorsOccurred.
pConnection
The pConnection parameter is the Connection object that is associated with the BeginTrans method call that fired the event.
 
 
EventStatusEnum Constants 
 
Constant
Value
Description
adStatusCancel
4
Cancels the operation that fired the event
adStatusCantDeny
3
Cannot cancel pending operation
adStatusErrorsOccurred
2
Indicates that warnings and/or errors occurred
adStatusOK
1
The operation that fired the event was successful
adStatusUnwantedEvent
5
The operation that generated the event cannot generate future events
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_BeginTransComplete( ByVal TransactionLevel As long, _
   ByVal pError As ADODB.Error, _
   adStatus As ADODB.EventStatusEnum, _
   ByVal pConnection As ADODB.Connection )
 
' place any code you desire here, for example
Print "Transacation Level = " & TransactionLevel
 
End Sub