BeforeBeginTransaction Event

Microsoft Access Visual Basic

Show All

BeforeBeginTransaction Event

       

Occurs just before Microsoft Access signals to the server that a batch transaction is beginning.

Private Sub Form_BeforeBeginTransaction(Cancel As Integer, Connection As ADODB.Connection)

Cancel   Setting this argument to True cancels the batch transaction while retaining all pending changes on the form.

Connection   The connection on which the batch transaction is taking place.

Remarks

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

This event is used for any processing that needs to occur before Access initiates a batch update. Any changes made to the data at this point are made outside the batch transaction.

Example

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

Private Sub Form_BeforeBeginTransaction( _
        Cancel As Integer, Connection As ADODB.Connection)
    Dim intResponse As Integer
    Dim strPrompt As String

    strPrompt = "Batch transaction about to begin on " _
        & Connection.Name & ". Do you wish to continue?"

    intResponse = MsgBox(strPrompt, vbYesNo)

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