Q. Difference between today's date in a form, and a fixed date?

  • Thread starter Thread starter Jim Jones
  • Start date Start date
J

Jim Jones

Hi,

I have a need to put the current date on a form, as well as a date
that is a time/date stamp, in a field that will be saved in a table.

Please advise on how to set up each.

Thanks,
Jim
 
to put the current date, you would simply create a text box and put the
following in the control source source:

=Date()


To build a timestamp, you would want to put something similar to the
following in the before update property of the form. You must first build a
field called timestamp.




Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
End Sub
 
Hi,

I have a need to put the current date on a form, as well as a date
that is a time/date stamp, in a field that will be saved in a table.

Please advise on how to set up each.

Thanks,
Jim

For today's date, just use an unbound Textbox with a default property
of Date().

To store a timestamp of when the record was created, put a date/time
field in the table, and set its Default property - in the table - to
Now().
 
to put the current date, you would simply create a text box and put the
following in the control source source:

=Date()


To build a timestamp, you would want to put something similar to the
following in the before update property of the form. You must first build a
field called timestamp.




Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
Me.Timestamp = Format(CurrentUser, ">") & " " & Date & " " & Time
End If
End Sub

Hi,

That looks like it would work, but when I had a similar issue a while
ago, there was no code involved.

Let me clarify what I need:

I need a date which constantly updates on the form
(always current date).

Then, I have a form in which one of the fields is to be set to the
'timestamp' date.

Thanks,
Jim
 
For today's date, just use an unbound Textbox with a default property
of Date().

To store a timestamp of when the record was created, put a date/time
field in the table, and set its Default property - in the table - to
Now().

John, That's it.

Thanks to all who responded to this thread.

Jim
 
Back
Top