Discussion Locked

Time stamp on insertion of a record in A

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do you create automatic time stamp for when a record is inserted into a database in Access 2000? Is there a way?

6 replies

by inspectorclave

There are several ways to do this. One way is to create a field that you want to store the time in (ex: xTimeStamp). In the table, specify the data type of the field as Date/Time and set the formatting for what you want (short time, long time, etc.). Next, add the field to the form, set the Enable attribute to No and the Locked attribute to Yes (this will prevent the field form being edited by the user). Create a command button and put the following code in the OnClick event:

Dim xDate as Date
xDate = Now
Me.xTimeStamp = xDate
DoCmd.GoToRecord , , acNewRec

Lastly, remove the Navigation Buttons from the form.

by kkenkel513

Another way is to add a date/time field to the table and set the default value to Now() in the Design view. This will grab the time that the first character was typed into the new record. If you actually want the exact time the record was inserted, you'll have to use code as shown in the other answer.

by icapan

In table you put the field time, and on the defalut value put now(), adn chose the format which you wont, on form if you need to see or not need put the propritites visible yes or no

This discussion is closed to new replies.