Last Changed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I was wondering what the best (or easiest) way to track when the last time a
record was changed/updated?
 
Unfortunately Access doesn't support triggers. However there is an After
Update event at form level or even the Dirty property of the form. They could
be used to update a date/time field to Now().

The key here is that it must be a form. If someone is changing data directly
at form level or using update queries, you are out of luck with .mdb files.
 
Thanks that's what I thought. Yes, all the data is updated through a form.
I've got a field in the table called LastUpdated (date formattted). Could you
help me with suggesting what sort of code would I have to put in the After
Update event to get this working.
 
On the form's Dirty event, put the following:

Private Sub Form_Dirty(Cancel As Integer)
Me.LastUpdated = Now()
End Sub

You may need the LastUpdated field on the form; however, it can be hidden.
 
Hammer said:
Thanks that's what I thought. Yes, all the data is updated through a
form. I've got a field in the table called LastUpdated (date
formattted). Could you help me with suggesting what sort of code
would I have to put in the After Update event to get this working.

BeforeUpdate, not AfterUpdate. If you edit a record in AfterUpdate you
trigger another update and get stuck in a loop.

In BeforeUpdate..


Me!LastUpdated = Now()
 

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

Similar Threads


Back
Top