Audit Trail not working in subform...

Hi, I'm a bit of a beginner too. I've got the audit trail working on a simple form without issue but cannot get it to work on subforms consistently.

I've attached an example of my DB, I've stripped it down so only bare minimum.

It has two forms which are actually being used as subforms within a navigation form. I have two audit modules basAudit and basAuditsub, the differences being that the sub one has some slightly different code based on something I found on google, I then set the forms to call the sub module instead of the main one. This has worked on the 'add' form/subform but I cannot get it to audit record any edits in the other form, with either module?

Any help appreciated!
 

Attachments

Good morning Rob3!

Where is your audit trail table and the modules you are using? Thanks!
 
Nevermind, I found them (they were hidden) not enough coffee....
 
They are probably hidden! Sorry! Should have said.
 
You are using the same code I am. As long as you have a field's "tag" set as "Audit" (in each field of your subform) and the "before update" form event of your subform set to

Private Sub Form_BeforeUpdate(cancel As Integer)
If Me.NewRecord Then
Call AuditChanges("id", "NEW")
Else
Call AuditChanges("id", "EDIT")
End If
End Sub

The audit should work fine. The subform will run its own audit. Don't use the "AuditChangessub" just use "auditchanges" - it worked for me.

Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom