How to advance date field by one day on mouse click?

S

SamJ

I have a date field in a form and I want to be able to advance whatever
date is presently in it by one day with a click of the mouse. What do I
enter in the On click property of the field?
Thanks.
 
A

Arvin Meyer [MVP]

SamJ said:
I have a date field in a form and I want to be able to advance whatever
date is presently in it by one day with a click of the mouse. What do I
enter in the On click property of the field?
Thanks.

Better to use the + and - keys, but here's the code you need for the Click
event of the mouse:

Sub DateField_Click()
Me.DateField = Me.DateField + 1
End Sub
 
A

Al Campagna

Sam,
Using the Date field (ex. DueDate) Click event...
DueDate = DueDate + 1
or... more formally
DueDate = DateAdd("d", +1, DueDate)

But... I would suggest using another event. If the user clicks on the
field to edit the date, that would trigger the +1.
Perhaps the Double-Click of DueDate might be better...
or
I often create a little minus button, and plus button on either side of the
date field so....
[-] DueDate [+]
so the user can click those to adjust the date.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
S

SamJ

Better to use the + and - keys, but here's the code you need for the Click
event of the mouse:

Sub DateField_Click()
Me.DateField = Me.DateField + 1
End Sub

Great, thanks.
S
 
Top