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

  • Thread starter Thread starter SamJ
  • Start date Start date
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.
 
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
 
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."
 
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
 

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

Back
Top