Megin
asked on
Access: force a user to choose a friday from the calendar?
On one of my Access forms I have a field that the user can add a date to. It formatted to 'date' so the little calendar appears when they click on it and they chose the date from there.
Is there a way to limit their choice to a Friday?
Is there a way to limit their choice to a Friday?
As samo4fun indicated, you can't modify the calendar that I'm aware of, but you can check if the weekday for a date is a friday in the controls beforeupdate event.
Do:
Cancel = True
if an error occurs. This will stop the control from accepting the value
Jim.
Do:
Cancel = True
if an error occurs. This will stop the control from accepting the value
Jim.
Friday is day 5 of the week if it starts on Monday. It is day 6 if the week starts on Sunday. In the US we generally use Monday as the start of the week but you can override that if necessary.
Hi,
normally the user should know that he should only choose a Friday, i.e. through a hint on the form or anything else like that.
So the more userfriendly method would be to check the chosen date after input and programmatically change the date to the Friday date of the same week. On this way the user can click on any date in a week and automatically gets the Friday date which is better than choosing a date and annoy him with a message box which says "hehehe...silly user, you have again chosen the wrong day, try it again and if you do not choose a Friday I will come back to laugh at you again!"
As said above, the user should already know to choose a Friday so he will not be surprised that the date changes to the Friday date of the same week, he will instead love the comfort.
Cheers,
Christian
normally the user should know that he should only choose a Friday, i.e. through a hint on the form or anything else like that.
So the more userfriendly method would be to check the chosen date after input and programmatically change the date to the Friday date of the same week. On this way the user can click on any date in a week and automatically gets the Friday date which is better than choosing a date and annoy him with a message box which says "hehehe...silly user, you have again chosen the wrong day, try it again and if you do not choose a Friday I will come back to laugh at you again!"
As said above, the user should already know to choose a Friday so he will not be surprised that the date changes to the Friday date of the same week, he will instead love the comfort.
Cheers,
Christian
ASKER
samo4fun: That looks great, but I can't use Me.DatePicker. DatePicker is not available to me.
Bitsqueezer: That would be fantastic, but I have no idea where to start with that. Can you help me out further?
Bitsqueezer: That would be fantastic, but I have no idea where to start with that. Can you help me out further?
You need to download it and register it to your system..
Download here : http://www.microsoft.com/en-us/download/details.aspx?id=10019
then use this steps to register it http://support.microsoft.com/kb/249873
Than you will be able to use it
Download here : http://www.microsoft.com/en-us/download/details.aspx?id=10019
then use this steps to register it http://support.microsoft.com/kb/249873
Than you will be able to use it
The date picker has been integrated since A2007. It is automatically activated for any control bound to a field with a date data type. To make an unbound control a "date", you need to specify a date format for the control.
ASKER
Sorry. I don't think I was clear.
The actual datepicker attached to the field works fine.
The problem is using it in the VBA code. It is not a method/data member that is available to me.
The actual datepicker attached to the field works fine.
The problem is using it in the VBA code. It is not a method/data member that is available to me.
maybe it is Me.DatePicker1?
ASKER
And I can't download it. I am on a network and am not an administrator. Downloading it requires administrator rights/
ASKER
When I type in "Me.", nothing beginning with the word "Date" shows up.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is perfect!!!!!
Just what I needed. Thank you!!!
Just what I needed. Thank you!!!
Open in new window