auto enter the date in a form

G

Guest

I want today's date to auto enter in a field on a form. But I want that date
to stay static with that particular record, I need to know the date each
record is entered. Will the =date() work for this. If I go back to a record
entered a month ago, will it enter the "today date" in the field, or will it
show the true date of entry?
 
D

Douglas J. Steele

You need to put code in the form's BeforeUpdate event to set the EnteredDate
field to the current date for new records.

Something like:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.NewRecord Then
Me!txtEnteredDate = Date()
End If

End Sub
 
R

Rick B

Enter =Date() in the control's DEFAULT. That will cause it to default in to
today's date, but not change when the record is accessed later. The control
has to be bound to a field in your table in order for it to be stored with
the record.
 
J

Jeff Boyce

Kitty

In design view, in the properties for that control, set the Default:
=Date()

This inserts the PC's date in any new record. Once you've save the record,
it isn't new anymore, so the default doesn't apply if you open it a month
later...

Be aware, though, that if you use:
=Now()
you will get the Date AND Time, useful if you want a date/time stamp on the
record, but more difficult to search for if you forget that you need to
consider/remember that both date and time are stored.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

With the form in design mode, right click on the date control (The box where
the date is to appear. Select Properties

In the properties box that pops up, select the format row (Page Tab all),
select how you want the date to appear, (Long Date, Short Date)
In the Default value of the properties box, type Date()

Each time a new record is generated now, the date will appear in the
control. Once a record is generated, (You fill in another control) todays
date will be placed in the field you have set up. This will be displayed as
the date you entered the record when ever you return to the record

Mike

--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all
and asked everyone you know,
read the instruction manual.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top