BeginBatchEdit Event

Microsoft Access Visual Basic

Show All

BeginBatchEdit Event

       

Occurs after the first change to data on a form that supports batch updates, either after the form is activated, or after the last batch transaction was committed.

Private Sub Form_BeginBatchEdit(Cancel As Integer)

Cancel   Setting this argument to True cancels the pending change, and thus the batch update, as there are no longer any pending changes.

Remarks

This event applies to Access project forms whose BatchUpdates properties are set to True.

This event is analogous to the Dirty event, but for an entire batch instead of an individual record. The BeginBatchEdit event occurs before the corresponding OnDirty event for the form and control.

Editing records on a subform does not trigger this event for the main form.

Example

The following example demonstrates the syntax for a subroutine that traps the BeginBatchEdit event.

Private Sub Form_BeginBatchEdit(Cancel As Integer)
    Dim intResponse As Integer
    Dim strPrompt As String

    strPrompt = "Batch update about to begin. " _
        & "Do you wish to continue?"

    intResponse = MsgBox(strPrompt, vbYesNo)

    If intResponse = vbNo Then
        Cancel = True
    Else
        Cancel = False
    End If
End Sub