[AccessD] Tracking real edits

Stuart McLachlan stuart at lexacorp.com.pg
Sun Jan 9 20:36:17 CST 2005


On 9 Jan 2005 at 21:13, John W. Colby wrote:

> 
> My client wants to create date stamp fields for groups of fields, i.e. a
> NameDateStamp, AddressDateStamp, PhoneDateStamp etc.  Thus I need to know
> that an edit happened and that the edit actually stored.  I've never really
> figured out a satisfactory way to do this.  Does anyone have a method that
> they use that appears to correctly handle all the nefarious things that a
> user can do?
> 

The way I usually do this sort of thing is:

In the Before_Update event - Loop through the data controls and compare 
.Value to .OldValue.  For any changed records, store .Name, .OldValue, 
.Value in an array/collection or whatever. If you use an appropriate naming 
convention for controls, it's fairly easy to step through all controls on a 
form and only check the appropriate ones.

In the After_Update -  step through the array/collection and log  ".Name, 
.OldValue, .Value, Now(), Username()" to a transaction log.

You could just  do it all in the After_Update since .OldValue doesn't get 
changed until after that event fires, but I  make it a habit to do the 
logging at the same time as I do any other validation of the data.

In your case, if the datestamp is in the same record as the data, you would 
just need to step through the data bound controls and update the relevant 
flags all in the Before_Update.



-- 
Stuart





More information about the AccessD mailing list