none
Date Picker question RRS feed

  • Question

  • Is it possible to use the date picker in addition to an input mask for the date field?

    I have an access 2013 form that has a short date field.  When I specify an input mask, the date picker doesn't work.  When I take the input mask away, the date picker works fine.  I would like to give the user the ability to either type the date in with the assistance of the input mask, or use the date picker.

    Is this possible?

    Tuesday, July 26, 2016 3:54 PM

Answers

  • Hi tkosel,

    I had made a many test and find that no any events and no any other work around can solve this issue.

    you can give a last try to Mr.Allen Browne 's example.

    if it not work for you I am afraid you can't achieve this.

    so tell the user to select one feature from that two.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by tkosel Thursday, July 28, 2016 2:30 PM
    Thursday, July 28, 2016 7:50 AM
    Moderator

All replies

  • Not tried what you want to do but it's definitely possible if you use VBA. Do you?

    Best regards, George

    Tuesday, July 26, 2016 4:13 PM
  • George,

    Yes I do. 

    Tuesday, July 26, 2016 4:25 PM
  • Ok, use the Change Event of the Date Picker. More info here:
    https://msdn.microsoft.com/en-us/library/office/gg251104%28v=office.14%29.aspx?f=255&MSPPError=-2147217396

    Look for: Private Sub calendarForm_DateChanged(newDate As Date)

    That is the event you want to have to validate the date.


    Best regards, George

    Tuesday, July 26, 2016 4:41 PM
  • Hi. I haven't tried it either, but you might be able to use an Input Mask and this popup calendar from Allen Browne. Just my 2 cents...
    Tuesday, July 26, 2016 5:00 PM
  • George,

    Thanks for your quick responses, but I guess I must be dumber than I thought.  I don't see how the Change Event can be used to do this.  First, if I specify a input mask, the date picker will never appear.  If I don't specify a mask, the date picker will appear.

    How do I get the change event to fire, unless I actually start to type in the field?  I tried setting no input mask, setting the date picker property to true and using the change event to set the input mask.  That didn't work.

    I don't want to validate the date, I want to force it to the correct input format at input time if the user decides to manually input it.

    Tuesday, July 26, 2016 5:27 PM
  • Hi tkosel,

    From this two functionalities, at a time you can only one of them.

    you had mentioned that ,"I want to force it to the correct input format at input time if the user decides to manually input it."

    but here I did not understand if your textbox is already set to short date field then user input date in any format it will automatically format the date in short date format. there is no need to use input mask.

    you can see the example below.

    my current format is short date. when I select date from date picker it will looks like in below format.

    now lets say user is entering the date by various ways. like below.

    then when I click enter it will automatically converted to short date format. you will get result like below.

    if user put date like below.

    then also you will get output like below.

    For more information please visit link below.

    Add and customize date and time formats

    TextBox.Format Property (Access)

    Regards

    Deepak

    ,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 27, 2016 5:20 AM
    Moderator
  • Deepak,

    Thanks for your response.  The textbox that I want to enter the date into has its format set to short date.  It is bound to a date field.  If I use the date picker, it places the date into the correct format.

    If the user types the correct characters in, (including / or - characters), it stores it correctly. 

    Here is where my problem comes to light.  These users are used to having an input mask for date in past applications, and don't want to type in the separator characters.  They want it to fill these characters in for them.  They want to type 09302016 and have 09/30/2016 appear in the field.

    Now some guy who worked for another company told them about the date picker, and they liked the idea of having both methods available.  I think I am coming to the definite idea that this cannot be done! 

    Unless someone tells me otherwise, that is the approach I will use.

    Wednesday, July 27, 2016 1:52 PM
  • You can give them 2 controls - and let everyone choose which they prefer to use.  Of course behind the scenes you must write the data into the field that is the permanent store.

    Wednesday, July 27, 2016 2:01 PM
  • You can give them 2 controls - and let everyone choose which they prefer to use.  Of course behind the scenes you must write the data into the field that is the permanent store.

    Thanks for the suggestion, you are right, I could do that.  However, if they have two, a lot of them will feel that they are supposed to fill them both in.  This will cause more confusion that it is worth, I think I will just make the users decide what they would rather have, the date picker or the input mask!

    Wednesday, July 27, 2016 2:07 PM
  • actually you could auto fill the 2nd box - which ever they choose .... plus move the focus to the next control and jump forward....

    a label might help explaining things though.....

    Wednesday, July 27, 2016 2:14 PM
  • Unless someone tells me otherwise, that is the approach I will use.

    Hi. I'm just curious... Did you see my post earlier? Since you can't use the built-in date picker with an input mask, I offered a solution to keep the input mask and use a custom date picker. Is this not acceptable for your situation?
    Wednesday, July 27, 2016 3:03 PM
  • DBGuy,

    I apologize, I did see it and should have thanked you for your suggestion.  If the users give me a lot of grief about the path I am going to take, I will give that a try.  It looks as if that will work pretty good

    As usual Mr. Brown has good stuff.

    The only potential problem that I have found, is that while the input mask property can be filled in and produces the result I desire, if the user were to type in "09302016", it does complete the input mask as "09/30/2016", but if the user then clicks the calendar button (why I don't know, but you know how they are!) they get a "Error 13: Type mismatch" message.

    Wednesday, July 27, 2016 3:25 PM
  • Should be just a matter of stepping through the code and see how the situation can be handled. Also, I have not tried this but with an input mask, I assume it will allow the user to enter something like 99999999, correct? If so, I think George's earlier idea of using the Change event should also work. In a sense, you don't need to "validate" if the user is entering a valid date because Access will do it automatically anyway. If so, you just need to add the "/" after the second and fourth digits, as they enter the date. For example:

    Select Case Len(Me.DateControl.Text)

       Case 2, 5
          Me.DateControl = Me.DateControl & "/"

    End Select

    (untested)
    Hope it helps...

    Wednesday, July 27, 2016 3:47 PM
  • Hi tkosel,

    I had made a many test and find that no any events and no any other work around can solve this issue.

    you can give a last try to Mr.Allen Browne 's example.

    if it not work for you I am afraid you can't achieve this.

    so tell the user to select one feature from that two.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by tkosel Thursday, July 28, 2016 2:30 PM
    Thursday, July 28, 2016 7:50 AM
    Moderator
  • Deepak,

    I agree with your conclusion.  The only reason that I had pursued this thread, was other participants gave me information that sort of led me to conclude that perhaps it could be done. 

    Thanks for your help in this matter.

    Thursday, July 28, 2016 2:30 PM