Used to cancel a pending batch update.You must be in batch update mode.
The CancelBatch method is called to cancel a pending batch update.
The Recordset must be in batch update mode, otherwise an error will occur.
Since you cannot predict what the current record will be after calling this property,
you will need to move to a known record.
For example, you could call the MoveFirst method,
after the call to the CancelBatch method is completed.
If the attempt to cancel the pending updates fails, the provider does not halt execution,
but it will send warnings to the Errors Collection.
Therefore you should always check the Errors Collection after the
call to the CancelBatch method is completed.
There is one optional parameter.
AffectEnum Constants
Constant | Value | Description |
---|---|---|
adAffectAll | 3 | Cancels all pending updates including those hidden by a filter |
adAffectAllChapters | 4 | Cancels all pending updates in all child (chapter) recordsets |
adAffectCurrent | 1 | Cancels only the current record |
adAffectGroup | 2 | Cancels updates only on records that passed through the filter in effect |
If MsgBox("Batch Save All Changes", vbYesNo) = vbYes Then
objRecordset.UpdateBatch
MsgBox "All Changes Updated"
Else
objRecordset.CancelBatch
MsgBox "All Changes Cancelled"
End If