Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

ACCESS - date update in a record...

Built with access a database with a list of contacts.

One of the fields should show the date of the last change made in the record.

How do I manage to update the date-field automatically everytime a change is made in the record?

Help me please... 'cause I'm going completely nuts!
[318 byte] By [faraldi03] at [2007-11-11 8:50:50]
# 1 Re: ACCESS - date update in a record...
Create a field to store the time the record was last updated. Set its data type to Date/Time. Set its Default Value to Now(). Each time the record is updated, the Date/Time field will automatically be assigned the current date and time.
Phil Weber at 2007-11-11 17:24:57 >
# 2 Re: ACCESS - date update in a record...
Default Values only fill in when a new record is inserted, so setting Default = Now()
will not change the date when the record is modified. In the Form's BeforeUpdate Event you can set the value of a field Like This:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.dtLastChange = Now()
End Sub
Ron Weller at 2007-11-11 17:25:57 >