Date and Time Table Modified

G

Golfinray

I have 4 forms used by managers to enter data. When they enter data, the data
is saved in tables. I would like to include a date and time stamp so that I
know when they entered each piece of new data. Do I need to have a field in
my table to collect the date and time? How do I collect that in my form?
Thanks!!
 
D

Douglas J. Steele

Yes, you need to add a field to your table.

In the form's BeforeUpdate event, put code to update that field. Assuming
that you named the field LastUpdated and that you included the field in the
form's RecordSource, the code would look something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

Me.LastUpdated = Now()

End Sub
 
Top