Logging Entries

D

Dewald

Hi all.

I really hope that someone would be able to help me. what i am looking to do
is keep a log file of What has happened on the database. IE. if a user
enters a new record i want it to diplay in the log with time and date. and
maybe the id.

Thanks for the help.
 
A

Allen Browne

Access does not do this for you.

To record who inserted a new record and when, just add two fields to the
table:
Field Name Field Type Default Value
--------------- --------------- -------------------
EnteredOn Date/Time =Now()
EnteredBy Text =CurrentUser()

To record who last changed the field, and when, add two more fields:
ModifedOn Date/Time
ModifiedBy Text
and use the BeforeUpdate event procedure of the Form to assign values to
these fields:
Private Sub Form_BeforeUpdate()
If Not Me.NewRecord Then
Me.ModifiedOn = Now()
Me.ModifiedBy = CurrentUser()
End If
End Sub

If you want to create a full logging of inserts, deletions, and the values
before and after each edit, see:
Audit Trail - Log changes at the record level
at:
http://members.iinet.net.au/~allenbrowne/AppAudit.html
 
Top