Need to automatically update the date field in a form when record changes

  • Thread starter Thread starter Stacey Boyd
  • Start date Start date
S

Stacey Boyd

I have a date field in a form that I'm using that I want to
automatically update to the current date anytime I change
any
information in that record.
Therefore, if the original date I worked on a customer
record was
6/20/03 and I changed some information on 10/30/03, I
would want it to
change the date to 10/30/03. This way, the next time I
look at the
record I will be able to know when I last changed
information and
therefore how recent and accurate the record information
is. Does
anyone know how to do this? Someone told me a long time
ago, but I
have since lost the instructions and can't remember how.
Can anyone
help?
 
I have a date field in a form that I'm using that I want to
automatically update to the current date anytime I change
any
information in that record.

You'll have to ensure that the ONLY way to change a record is via a
Form (either administratively, "you'll be fired if you change data in
a table datasheet", or using database security). Table datasheets
don't have any usable events.

In the Form's BeforeUpdate event invoke the Code Builder (by clicking
the ... icon and choosing Code); Access will give you the Sub and End
Sub lines, you just need to add one more, using your own fieldname:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Me!Timestamp = Date() ' or use Now() if you want date & time
End Sub
 
Back
Top