After a command has finished executing, you can call this event to provide information on the successof the command and the number of records affected.
The ExecuteComplete event can be fired after either a Command.Execute, Connection.Execute, Recordset.Open, Recordset.Requery, or Recordset.NextRecordset method has completed execution. This event is one of two command execution management events that can be called. The other event is WillExecute.
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 six parameters that are passed to this event.
Parameter
| Description
| RecordsAffected
| The RecordsAffected parameter is a long value that is the number of records affected by the execution.
| 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 command that caused the event to fire was successful, this parameter is set to adStatusOK. If the command was not successful, this parameter is set to adStatusErrorsOccurred. To prevent unwanted future firings of this event, set this parameter to adStatusUnwantedEvent before the event returns.
| pCommand
| The pCommand parameter is the Command object that was executed.
| pRecordset
| The pRecordset parameter is the Recordset object that resulted from the execution of the command.
| pConnection
| The pConnection parameter is the Connection object that is associated with the execution of the command.
|
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
|
|