Audit trail For three forms to the main frm (1 Viewer)

Falcon88

Registered User.
Local time
Today, 21:56
Joined
Nov 4, 2014
Messages
299
???
There is a word document describing the sample application and audit trail.

What exactly is the issue?
i have make an example with access 2007 , but not work .

see to attachment.
 

Attachments

  • MyNewTest.zip
    55.3 KB · Views: 146

jdraw

Super Moderator
Staff member
Local time
Today, 14:56
Joined
Jan 23, 2006
Messages
15,379
I'm not sure what the issue is - my guess is that there is a reference problem.
I have 2010 and an Office365 account. I see reference to Office 16 Access database engine.
And it's unlikely you have that.
Perhaps someone else, more familiar with library references, will have a suggestion/solution.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:56
Joined
Feb 28, 2001
Messages
27,137
Here is the real problem. Code that is supposed to work from more than one form should not be in ANY of the form class modules. It should be in a general module with keyword Public in front of the sub. Then you don't need "parent" references. What you need is to pass the identity of the caller of this function.

Code:
Public Sub AuditForm( fTgt as Access.Form, ....{other arguments if any})
Dim cCtl as Access.Control
    For Each cCtl in fTgt.Controls
       ... (do your auditing thing)
    Next cCtl
End Sub

Then when you call this from each of the forms that need it, you use

Code:
    AuditForm Me, ...{other arguments if any}

If you want form A to be audited, you do so by calling the audit subroutine from form A's AfterUpdate event. If you want form B to be audited, you ALSO call the audit subroutine from form B's AfterUpdate event. And so on.

Do NOT expect it to be easy to trigger an audit or anything else for three forms. Make EACH FORM call the auditor on its own. When I was learning about software engineering and device drivers, we learned a simple principle. If it is important to do something, don't rely on someone else to do it for you. Do it yourself. Which doesn't mean you can't call a subroutine to do the actual work. What it DOES mean is that if you want a subroutine called in a certain place, don't assume someone or something else is going to call it for you. YOU should assure that the call occurs where it should happen.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:56
Joined
Feb 28, 2001
Messages
27,137
jdraw - when I post at night (see time on my post), sometimes I'm a bit bleary and miss things. Bad habit, I guess.
 

jdraw

Super Moderator
Staff member
Local time
Today, 14:56
Joined
Jan 23, 2006
Messages
15,379
Doc,
Not an issue. The database I submitted was a follow on to a post about Martin Green's audit trail sample in which a poster and I found inconsistencies. Your summary/comments reinforce the approach.

The ongoing issue in this thread is that the poster has used the sample database set up with his own data and database and has an error -which we have confirmed - with his database that is not in the original. The source of the error has not been identified/resolved. (see post 23 in this thread for a link related to his current issue).
 

Users who are viewing this thread

Top Bottom