auto insert date/time

  • Thread starter Thread starter Rick B
  • Start date Start date
R

Rick B

I have a form users currently use to enter data. I would like to add 2
textboxes:

One which will show the present date and time whenever a record is modified
and also add this date to the record itself
One which will insert the present date and time whenever a record is created
and also add this date to the record itself

-rick
 
The create date is easy. In table design view, set the field's DefaultValue
property to:
=Date()

The modified date can only be maintained if the data is changed through a
form. Use the BeforeUpdate event procedure of the form:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[NameOfYourDateFieldHere] = Date()
End Sub

If you want the time as well as the date, use Now() instead of Date().
 
Back
Top