Results 1 to 3 of 3
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    658

    VBA commitment

    I'm just about to start on a project that will have some VBA code updating multiple records in multiple tables.

    I haven't yet seen a good class on the transaction commitment features in Access.
    Has anyone got a nice simple demo db that shows the proper way to implement it?

    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Here is one example:
    Code:
    Private Sub btnDelete_Click()
    Dim cn As ADODB.Connection
    Set cn = CurrentProject.Connection
    cn.BeginTrans
    If DeleteTests(Me.LABNUM, Nz(Me.lbxMaterial, "")) = True Then
        cn.CommitTrans
        booTestsEdited = True
        Me.Refresh
    Else
        cn.RollbackTrans
        MsgBox "There was a problem deleting all lab tests.  Contact Administrator", , "RemoveTestsError"
    End If
    Me.cbxTests.SetFocus
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums