Date Updated Column

  • Thread starter Thread starter David F
  • Start date Start date
D

David F

In SQL Server I can use a trigger to populate a "date created" and "date
updated" field.

For example, in my orders table I have a "date created" and "date updated"
field. When a row is added to this table, both of these fields are updated
by the trigger with the INSERT date. Later, if the row is modified, the
"date updated" field is modified with the UPDATE date.

This gives me a nice audit trail for the activity in the table.

Is there any way to accomplish this in Access?

Thanks
 
You can use code in the before update event of a form to set the values of
the fields.
 
The only one you can do automatically is a date created
field. Create a new date field, and in it's default value
property, put in =Now().

The Date Updated is harder. In the forms, on the
BeforeUpdate or AfterUpdate, add a line of code that says
DateUpdated = Now().

If you run any queries that change the data, or if you
change it in table view, or by code, or by a form that
does not have this auditing feature, the field will not be
updated.


Chris
 
Back
Top