Log forms fields changes (except Null to value changes)

snoopy2003

Registered User.
Local time
Today, 04:03
Joined
Aug 26, 2012
Messages
13
Hello,

I have access tool with front end and back end parts.
My user works with forms in order to add new records or edit records.
I wish to "catch" the following events -
if the user modify field's value (which is not NULL) I wish to display a notification message and update a comment field / log table with old field data, new field data, time and user name.
If the user update field's value from NULL to other value I do not need to log it.

Can I do it in the form level and not for each field ?
I wish to discover the modified fields names and analyze their values before and after the update.

How can I do it ?

Thank you for your help
 
In the form before update event, go through each control with a valid controlsource comparing .value with .oldvalue and where they are different and the oldvalue is not null, run an insert query into your log table.
 
You're talking about creating an Audit Log. Here is an excellent tutorial on the subject:

http://allenbrowne.com/AppAudit.html

Be warned, though, this kind of thing is never going to be a simple task, and you'll need to follow Allen's instructions closely!

Here’s another tutorial, form the Boys of Redmond; it states that it is for Version 2000, but can be used for all versions after that, I believe.

http://support.microsoft.com/kb/197592

The same caveat applies to this example, as well!

Linq ;0)>
 
Hello,

Thank you for your answers.
Your suggestions will solve my problem.

Before implementing the code - Is there any way to write a general solution that will not include controls names (because my system is constantly modified)? I mean to write a code in a form event that will go over all modified controls, check them and display notification/save to log in appropriate cases ?

Thank you very much for your support
 
The links provided by missinglinq are very good and are robust and can be implemented to any Forms.
 

Users who are viewing this thread

Back
Top Bottom