Record exact date and time a record is entered

  • Thread starter Thread starter Tommy Hutchison
  • Start date Start date
T

Tommy Hutchison

I want to record the exact date and time a record is
entered. The Now function sets the date and time for the
next record I enter not the current record. Thus when I
enter a record I want the date field to show the time
when I have finished inputting the current record. Any
help would be appreciated!@!
 
Put this code on the form's Before Insert event:

Private BeforeInsert(Cancel As Integer)
Me.DateTimeFieldName.Value = Now()
End Sub
 
Sorry but I am new to access - how exactly do I go about
doing what you suggested?
Thanks in advance for your help!!
 
Set up a form that uses the table as its RecordSource. While the form is in
design view, open the Properties window, click on Event tab, click in box
next to Before Insert, click on three-dot box at far right of box, select
Code Builder, and paste the second line between the first and third lines
that you'll see displayed in the Visual Basic Editor window. Close the VBE
window.

Put your fields onto the form as controls. Save and name the form.

You're now ready to use your form for entering records.

Note that you cannot do this directly in the table.

If you want to enter data directly in the table, you can use the
DefaultValue of the DateTimeFieldName field as
=Now()
..
..
 
Back
Top