Full Version: Input todays date with a checkbox
UtterAccess Forums > Microsoft® Access > Access Forms
I would like a form to have a checkbox on it with the caption "today?" and would like if the checkbox is ticked for todays date to be placed in a field of a table.
any instructions? I assume its something like the following, but i have made assumptions before.......
Private sub chkbxTodaysDate_click()
me.txtOrderDate = today or now or some other identifier for today?
thanks in advance for your help
Jim Fuller
You probably want something like
If me.chkbxTodaysDate=true then
end if
If you dont want unchecking the check box to remove the date then just loose the If statement.
Thank you, works like a charm, adding the open and clse paren () is why i was unable to return a value.
Thanks again.
The only reason adding the () (That I can think of) is that you have a control on the form called "date"... have you?
I think it has to do with open ended formatting, like i could further format the date type by choosing date(mmddyy) or something like that, by leaving it blank i am asking for the default date tpye?
Odont have a "date" control, so i am not sure.
AFAIK The date function returns todays date formatted (well displayed) in either the format of the control it is returned in or if no format is specified then the date is returned in the systems default format specified in the region settings.
Have you tried the code without the () (Access usually removes them as they are unnecessary.
just did.
I think instead of "date" earlier i entered "today" and "day" and now i tried date with the () and w/o and you are right about when it corrects and removes them.
They are not necessary () but they are also not harmful.
I personally always add them in... just force of habit
had to look up IITYWTMWYBMAD
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.