Creating an Audit Trail in form with subform.

A

Allen Browne

Pass a reference to the form into the function, instead of relying on
Screen.ActiveForm.

1. Change the first line to:
Function AuditTrail(MyForm As Form)

2. Remove the line:
Set MyForm = Screen.ActiveForm

3. At step 7 in the kb. article, set the BeforeUpdate property of the form
to:
=AuditTrail([Form])
Note: enter exactly that: don't replace with the name of your form.

Of course, the subform's table will need its own Updates memo field.

A fairly serious limitation of that approach is that it does not log
deletions. For an alternative approach that involves more work, but creates
a log of edits, inserts, and deletions in a separate table, see:
Audit Trail - Log changes at the record level
at:
http://members.iinet.net.au/~allenbrowne/AppAudit.html
 
M

Mark F

Allen,

Worked like a bought one.

Ta v much.

Mark Felstead

Allen Browne said:
Pass a reference to the form into the function, instead of relying on
Screen.ActiveForm.

1. Change the first line to:
Function AuditTrail(MyForm As Form)

2. Remove the line:
Set MyForm = Screen.ActiveForm

3. At step 7 in the kb. article, set the BeforeUpdate property of the form
to:
=AuditTrail([Form])
Note: enter exactly that: don't replace with the name of your form.

Of course, the subform's table will need its own Updates memo field.

A fairly serious limitation of that approach is that it does not log
deletions. For an alternative approach that involves more work, but creates
a log of edits, inserts, and deletions in a separate table, see:
Audit Trail - Log changes at the record level
at:
http://members.iinet.net.au/~allenbrowne/AppAudit.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Mark F said:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q197592.

The above code words fine for controls in a form without subforms, Pages
or
tab Controls. Could someone suggest how it could be modified so that
changes
of data in subforms and tab controls are tracked.

My database in in Access 2003.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top