UndoBatchEdit Event

Microsoft Access Visual Basic

Show All

UndoBatchEdit Event

       

Occurs when the user discards all pending changes using the Undo All Records command.

Private Sub Form_UndoBatchEdit(Cancel As Integer)

Cancel   Setting this argument to True cancels the undo operation and retains all pending changes on the form.

Remarks

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

This event is analogous to the Undo event, but for an entire batch instead of an individual record. The event occurs after the Undo event for the form and control corresponding to the most recent data change.

The Undo event for the form only occurs for the last row edited. Likewise, only the most recent Undo event for the relevant control occurs even though changes are potentially discarded for more than one control when an undo operation is carried out on the form.

Example

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

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

    strPrompt = "Access is about to discard all pending changes. " _
        & "Do you wish to continue?"

    intResponse = MsgBox(strPrompt, vbYesNo)

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