WillChangeRecord and RecordChangeComplete (ConnectionEvent) Methods (ADO)

See Also   Applies To

The WillChangeRecord method is called before one or more records (rows) in the Recordset change. The RecordChangeComplete method is called after one or more records change.

Syntax

WillChangeRecord adReason, cRecords, adStatus, pRecordset

RecordChangeComplete adReason, cRecords, pError, adStatus, pRecordset

Parameters

adReason   An EventReasonEnum value. Specifies the reason for this event. Its value can be adRsnAddNew, adRsnDelete, adRsnUpdate, adRsnUndoUpdate, adRsnUndoAddNew, adRsnUndoDelete, or adRsnFirstChange.

cRecords   A Long. The number of records changing (affected).

pError   An Error object. It describes the error that occurred if the value of adStatus is adStatusErrorsOccurred; otherwise it is not set.

adStatus   An EventStatusEnum status value.

When WillChangeRecord is called, this parameter is set to adStatusOK if the operation that caused the event was successful. It is set to adStatusCantDeny if this method cannot request cancellation of the pending operation.

When RecordChangeComplete is called, this parameter is set to adStatusOK if the operation that caused the event was successful, or adStatusErrorsOccurred if the operation failed.

Before WillChangeRecord returns, set this parameter to adStatusCancel to request cancellation of the operation that caused this event.

Before RecordChangeComplete returns, set this parameter to adStatusUnwantedEvent to prevent subsequent notifications.

pRecordset   A Recordset object. The Recordset for which this event occurred.

Remarks

A WillChangeRecord or RecordChangeComplete event may occur due to the following Recordset operations: Update, Delete, CancelUpdate, AddNew, UpdateBatch, and CancelBatch.

During the WillChangeRecord event, the Recordset Filter property is set to adFilterAffectedRecords. It is illegal to change this property while processing the event.