UpdateBatch Method

The UpdateBatch method on a Recordset object writes all pending batch updates to the host.

recordset.UpdateBatch AffectedRecords
 

Parameters

AffectedRecords
This optional parameter specifies an AffectEnum value that determines how many records the UpdateBatch method will affect. The AffectEnum value can be one of the following constants:
Enumeration Value Description
adAffectCurrent 1 This value writes pending changes only for the current record.
adAffectGroup 2 This value writes pending changes for the records that satisfy the current Filter property setting. You must set the Filter property to one of the valid predefined constants to use this option.
adAffectAll 3 This value writes pending changes for all the records in the Recordset object, including any hidden by the current Filter property setting. This value is the default.

Remarks

The UpdateBatch method is used when modifying a Recordset object in batch update mode to transmit all changes made in a Recordset object to the underlying database.

If the Recordset object supports batch updating, then multiple changes to one or more records can be cached locally until the UpdateBatch method is called. If you are editing the current record or adding a new record when the UpdateBatch method is called, ADO will automatically call the Update method to save any pending changes to the current record before transmitting the batched changes to the provider.

If the attempt to transmit changes fails because of a conflict with the underlying data (for example, a record has already 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.

To cancel all pending batch updates, use the CancelBatch method.