Event Parameters

Every event handler has a status parameter that controls the event handler. Most Complete events have an error parameter to report whether the operation causing the event succeeded, and an object parameter to identify the ADO object to which the operation applied.

Will events are also passed the parameters to be used in the pending operation. This gives you the opportunity to examine the parameters and determine whether the operation should complete or not.

Status Parameter

When the event handler routine is called, the status parameter is set to one of the following informational values.

Value Description
AdStatusOK The operation that caused the event occurred successfully.
AdStatusErrorsOccurred The operation that caused the event occurred unsuccessfully, or a Will event canceled the operation. Check the error parameter for more details.

If a Will event canceled the operation, the Error objectÆs Number property will be adErrOperationCancelled.

AdStatusCantDeny A Will event cannot request cancellation of the operation about to occur.

Before the event handler routine returns, leave the status parameter unchanged or set it to one of the following request values.

Value Description
AdStatusUnwantedEvent Request this event handler receive no further notifications.
AdStatusCancel Request cancellation of the operation that is about to occur.

Depending on event type, the status operand can have one of the following values when the event handler is called.

Event Type Value
Will adStatusOK, adStatusCantDeny
Complete adStatusOK, adStatusErrorsOccurred

Depending on event type, the status operand can have one of the following values when the event handler returns.

Event Type Value
Will adStatusOK, adStatusCancel, adStatusUnwantedEvent
Complete adStatusOK, adStatusUnwantedEvent

Error Parameter

The error parameter is a reference to an ADO Error object containing details about why the operation failed if the status parameter equals adStatusErrorsOccurred.

Object Parameter

The object parameter is a reference to the ADO object for which the operation applies. For example, you could have several Connection objects open at one time and only one Disconnect event handler. If any one connection closed, the Disconnect event handler would be called with the object parameter set to the Connection object that closed.