View Single Post
  #5 (permalink)  
Old November 28th, 2006, 08:21 AM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Sure. In each table that you want to track these issues, create these four fields:

DateCreated - date/time - default = Now()
WhoCreated - text
DateModified - date/time - no default
WhoModified - text

Put these fields on your form, but make them invisible. At least change them to disabled.

Then on your forms, on the Before Insert insert event, add this code:

Dim sUser As String
sUser = (Environ$("Username"))
Me.WhoCreated = sUser

On the same form's Before Update event, add this code:

Dim sUser As String
sUser = (Environ$("Username"))
Me.WhoModified = sUser
Me.DateModified = Now()

This will track the date and time and who created each record, and the date and time of who LAST modified each record, if they use the form to create and modifiy records.

The only way to track the total modification history is to create a transaction table, and start logging old and new values in that table with this data as well.

HTH


mmcdonal
Reply With Quote