編輯

共用方式為


WillChangeField and FieldChangeComplete events (ADO)

Applies to: Access 2013, Office 2013

The WillChangeField event is called before a pending operation changes the value of one or more Field objects in the Recordset. The FieldChangeComplete event is called after the value of one or more Field objects has changed.

Syntax

WillChangeFieldcFields, Fields, adStatus, pRecordset

FieldChangeCompletecFields, Fields, pError, adStatus, pRecordset

Parameters

Parameter Description
cFields A Long that indicates the number of Field objects in Fields.
Fields For WillChangeField, the Fields parameter is an array of Variants that contains Field objects with the original values.

For FieldChangeComplete, the Fields parameter is an array of Variants that contains Field objects with the changed values.
pError An Error object. It describes the error that occurred if the value of adStatus is adStatusErrorsOccurred; otherwise it is not set.
adStatus EventStatusEnum. When WillChangeField is called, this parameter is set to adStatusOK if the operation that caused the event was successful. It is set to adStatusCantDeny if this event cannot request cancellation of the pending operation.

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

Before WillChangeField returns, set this parameter to adStatusCancel to request cancellation of the pending operation.

Before FieldChangeComplete returns, set this parameter to adStatusUnwantedEvent to prevent subsequent notifications.
pRecordset A Recordset object. The Recordset for which this event occurred.

Remarks

A WillChangeField or FieldChangeComplete event may occur when setting the Value property and calling the Update method with field and value array parameters.