Capturing who added/changed a record

  • Thread starter Thread starter Barb Fridinger
  • Start date Start date
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?
 
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.
 
Back
Top