Date() Automatic insert at mouse click

S

Steve

I want to have the current date automatically inserted into a field. I used the expression "Date()" as recommended in the help file, but this puts the date into the field immediately. I don't want it inserted until I click into that field with my mouse. In otherwords, I want a blank field until I choose for the date to be inserted automatically with the click of the mouse
Can anyone help with this one? Please respond to (e-mail address removed)
 
G

Graham R Seach

Steve,

In the control's Click or DblClick events, place the following code:
Me!myControlName = Date()

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Steve said:
I want to have the current date automatically inserted into a field. I
used the expression "Date()" as recommended in the help file, but this puts
the date into the field immediately. I don't want it inserted until I click
into that field with my mouse. In otherwords, I want a blank field until I
choose for the date to be inserted automatically with the click of the
mouse.
 
G

GVaught

Place an event against the date field on a form to be entered when the date
is clicked:

Private Sub CheckedDate_Click()
Me.CheckedDate = Date
End Sub


Steve said:
I want to have the current date automatically inserted into a field. I
used the expression "Date()" as recommended in the help file, but this puts
the date into the field immediately. I don't want it inserted until I click
into that field with my mouse. In otherwords, I want a blank field until I
choose for the date to be inserted automatically with the click of the
mouse.
 
J

Jennifer H.

You might also want to bracket the code given so far with
a condition testing for if the field is empty. Otherwise
whenever the user clicks on that field, its value will be
changed to today's date.

-----Original Message-----
I want to have the current date automatically inserted
into a field. I used the expression "Date()" as
recommended in the help file, but this puts the date into
the field immediately. I don't want it inserted until I
click into that field with my mouse. In otherwords, I
want a blank field until I choose for the date to be
inserted automatically with the click of the mouse.
 

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