Date Picker with Inputmask

T

tommg

Using Access 2007. I have a text box with the following properties set as
such:

Format = Short Date
Show Date Picker = For Dates
Default Value = Date()
Input Mask = 99/99/0000

Using the properties specified above, I simply do NOT get the date picker
displayed. The inputmask works as expected though.

If I remove the 'Input Mask', then the date picker will display as expected.

I tried showing the date picker through code on the GotFocus() event of the
control (DoCmd.RunCommand acCmdShowDatePicker), but received the following
error:

Runtime Error 2046. The command or action 'ShowDatePicker' isn't available
now.

Any ideas on how to be able to use both the Date Picker AND the Input Mask
on the same control?

Oh, and I tried it on a bound or unbound control and received the same
results.

Any help appreciated!
Thanks!
 
T

tommg

I finally found some confirmation on the MS site that if you use an Input
Mask, the date picker will not work:

http://office.microsoft.com/en-us/access/HA100964521033.aspx

<<Note If you use an input mask for a Date/Time field, the Date Picker
control is unavailable for use with that field.>>>

I can probably do a work around where I show a custom button that then pops
the calendar for a hidden text box or something, then set that value into the
real date text box... blah, blah, blah.... Not sure if it's worth it...

If anyone knows WHY the date picker control won't display because of an
Input Mask being specified, I'd love to know that one....

Thanks
 
J

Jason W

I left my date field as was and created an unbound text box next to it (maybe
label it 'Calendar') and set format to short date but with no imput mask. So
the user can still enter date in date field which has input mask but if they
want the date picker, click in the unbound text box next to it, date picker
will appear, select date and set After Update event to copy this date to your
date field. If you want to make it more compact, put the calendar label over
the top of the text box and set the 'click' event to set focus on text box. I
like to give my users the choice of default dates with imput mask and date
picker particularly in diary forms.
 
Joined
May 9, 2012
Messages
2
Reaction score
0
Put a small command button with a calender figure, next to date field

In my solution, the date field has the following properties
- format: short date
- InputMask: 99/99/9999

Here's the code for the command button
(Date1 is the date field)
Date1.InputMask = ""
Date1.SetFocus
DoCmd.RunCommand acCmdShowDatePicker
Date1.InputMask = "99/99/9999"

This way, I can use inputbox and date picker at the same time.
 

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

Top