on Dbl Click - to load current "DATE" in date field

MoHntr

Registered User.
Local time
Today, 17:01
Joined
Feb 20, 2010
Messages
21
I am trying to load the current date by double clicking a date field. I am using the expression builder and it places =date() . However this doesn't work. Any advice on what I have wrong? This is in a subform if it matters.

Thanks,

MoHntr
 
Doesn't sound like a very intuitive way of setting a date. I think you should use a button for this instead.

In any case, if you're still going to do it on Double Click, then you set the date on the ON DBL CLICK event of your text box. This can be found under the EVENTS tab, then you click the three dots "..." and select Code Builder. You will see something like this:

Code:
Private Sub [COLOR=Red]Textbox1[/COLOR]_DblClick(Cancel As Integer)
    [COLOR=Blue]Textbox1 = Date()[/COLOR]
End Sub
Put that line in blue in there. Change "Textbox1" to the name of your text box control or what you see highlighted in red.
 
Thank you for the quick reply. I was originally going to do this with the calander 11 but it seemed to mess up my continuous form so I thought this would be better.
Looking back I may have forgot to make it a popup.

Thanks again,

MoHntr
 
If your continuous form is a subform then you can put a button outside the subform (i.e. on the main), have a caption like "Today's Date" which when clicked will set the Date of the text box to today's date. No need to employ a calendar control if all you need it for is setting today's date.

You're welcome.
 

Users who are viewing this thread

Back
Top Bottom