Capturing who added/changed a record

B

Barb Fridinger

I am trying to capture who adds a record and when and who
changes a record and when. I am using the following code
for the events

Private Sub Form_BeforeInsert(Cancel As Integer)
[CreatedBy] = CurrentUser
[DateCreated] = Date
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)
[ModifiedBy] = CurrentUser
[DateModified] = Date
End Sub

It works OK, but when someone adds a new record it creates
records in both the Created and Modified. I understand
that with Access an insert also creates an update. Is
there an easy way to add the info just to the Created
fields without adding it to the Modified fields?
 
R

Roger Carlson

On my website (see sig below) is a small sample database called
"AuditTrail.mdb" which does this and a lot more. It might give you further
ideas.
 

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