PSSMargaret
Registered User.
- Local time
- Today, 03:15
- Joined
- Jul 23, 2016
- Messages
- 74
Thanks for the explanation.  For this database, there is no need for a users to be able to delete more than one record at a time.
 Margaret,
Here is a revised version of the Audit trail material that now supports subforms.

Sub AuditChanges(IDField As String, UserAction As String, pMyForm As Form) Dim cnn As ADODB.ConnectionDiogo Cuba,
...
I am attaching a revised zip file showing some new audit record @Jan 14 2019, the revised database and the revised word doc.
...
Good luck with your project.


Diogo Cuba,
...
Good luck with your project.


Public gRecID As Integer
Public show As Boolean
Public Sub SetMyGlobal(SelectedOption As Integer)
10  If SelectedOption = 1 Then
20      show = True
30  Else
40      show = False
50  End If
60  gRecID = 0
End Sub    Case "EDIT"
        'If show Then Debug.Print "ActiveForm is " & pMyForm.Name  --for debugging
...
280   Case "NEW"
290     If show Then Debug.Print "ActiveForm is " & pMyForm.Name
...
460   Case "DELETE"
        'If show Then Debug.Print "ActiveForm is " & pMyForm.Name   -for debugging
...
           'Debug.Print ctl.Name & "   " & ctl.Value 'For debugging the 438 error???
490         If ctl.Tag = "Audit" Then310         If ctl.Tag = "Audit" Then
                'If Nz(ctl.Value) <> Nz(ctl.OldValue) Then  '---jed No old value in a new record.
 
...
 
480     For Each ctl In pMyForm.Controls
            'Debug.Print ctl.Name & "   " & ctl.Value 'For debugging the 438 error???
490         If ctl.Tag = "Audit" Then
                ' If Nz(ctl.Value) <> Nz(ctl.OldValue) Then  '---jedI have a different example using data macros that may be of interest or reference. It does not depend on table events.
You can remove anything you want. I included debug statements that you can turn on/off since they can be helpful to follow the logic
...
I have no idea about runtime. I suggest you make a backup, then make a version for your specific requirement and test it. Let us all know what you find.
I have no idea about runtime. I suggest you make a backup, then make a version for your specific requirement and test it. Let us all know what you find.
ctl.ControlSourcectl.Name Maybe I will get my very fiurst "thanks" too on this forum!
 Maybe I will get my very fiurst "thanks" too on this forum!
OK I've obliged on your blatant request for your very first thanks at AWF.
But its well deserved. I'm sure there will be many more!

 Thanks, Colin!
 Thanks, Colin!

Private Sub cmdSave_Click()
    DoCmd.RunCommand (acCmdSave)
    Me.cmdUndo.Enabled = False
    Call AuditChanges("CardID", "EDIT", Me)
End SubPrivate Sub Form_BeforeUpdate(Cancel As Integer)
        Call AuditChanges("CardID", "EDIT", Me)
End SubPrivate Sub cmdSave_Click()
    ' SAVE THE RECORD
    DoCmd.RunCommand acCmdSaveRecord
    Me.cmdUndo.Enabled = False
End Sub