Date() Automatic insert at mouse click

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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)
 
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.
 
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.
 
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.
 
Back
Top