CancelBatch Method (ADO)

Cancels a pending batch update.




Optional. An AffectEnum value that indicates how many records the CancelBatch method will affect.


Use the CancelBatch method to cancel any pending updates in a Recordset in batch update mode. If the Recordset is in immediate update mode, calling CancelBatch without adAffectCurrent generates an error.

If you are editing the current record or are adding a new record when you call CancelBatch, ADO first calls the CancelUpdate method to cancel any cached changes. After that, all pending changes in the Recordset are canceled.

The current record may be indeterminable after a CancelBatch call, especially if you were in the process of adding a new record. For this reason, it is prudent to set the current record position to a known location in the Recordset after the CancelBatch call. For example, call the MoveFirst method.

If the attempt to cancel the pending updates fails because of a conflict with the underlying data (for example, if a record has been deleted by another user), the provider returns warnings to the Errors collection but does not halt program execution. A run-time error occurs only if there are conflicts on all the requested records. Use the Filter property (adFilterAffectedRecords) and the Status property to locate records with conflicts.

Applies To

Recordset Object (ADO)

See Also

UpdateBatch and CancelBatch Methods Example (VB)
UpdateBatch and CancelBatch Methods Example (VC++)
Cancel Method (ADO)
Cancel Method (RDS)
CancelUpdate Method (ADO)
CancelUpdate Method (RDS)
Clear Method (ADO)
LockType Property (ADO)
UpdateBatch Method