G
Guest
How do I set up an automatic date and time field in Access which updates upon
changes to the record?
changes to the record?
How do I set up an automatic date and time field in Access which updates upon
changes to the record?
John said:You'll need to do all changes to the data using a Form. Table
datasheets have no usable events.
Given this, just add a date/time field to the table, let's call it
ChangeTimestamp, and use VBA code in the Form's BeforeUpdate event:
Private Sub Form_BeforeUpdate(Cancel as Integer)
<any record validation code here>
Me!ChangeTimestamp = Now
End Sub
Isn't the assumption that all changes to the data *will* be done 'using
a Form' wishful thinking? The front end shouldn't be used in place of
database constraints. How about a CHECK constraint to ensure the date
amended is always current? e.g.
John said:That would be nice if Access supported CHECK constraints, Jamie.
Sorry, we're not using SQL/Server here. This is a different program
with different syntax. Triggers would be nice too.