none
MS Date & Time Picker Control 6.0 (SP4) RRS feed

  • Question

  • Almost ready to give up....

    I am using Access 2013.  I have a form with a DTPicker object that is unbound.  It appears that when the form is opened, the object defaults to the date I added the object to the form, but the desired objective is to default the object to today's date when the form is opened.  After the form is open, I should be able to change the date value to whatever.  Here's what I've tried:

    1) In the OnOpen event, I try to directly assign the value --   Me.myDateControl.Value = Date()  -- I get an error that the object is read only.  (Seems sort of odd that they would let us see, but not set, the Value, but it is what it is.)

    2) I tried to set the control source of the object to =Date().  Now when the form opens, it does default to today's date, but then I can't use the Date Picker -- it just keeps jumping back to today's date when I try to select an alternative date.

    3) After #2 above, I tried setting the object's control source to Date().  And then when I click on the object to change date, add some code to the object's OnGotFocus event to set the ControlSource to "".  Didn't work.  Maybe I'm not removing the control source in VBA correctly.

    Please note that my form is not bound to a table so it's not an option for me to create a text box whose control source is date field in a table (that would automatically use the date picker).    A solution here has to work on a form that is not bound to a table.

    Thanks in advance for any ideas you can offer.


    Wednesday, March 14, 2018 4:49 PM

Answers

  • Hello rich30005,

    I failed to reproduce your issue. I tried to add a Date & Time Picker Control to a new blank form and saved it yesterday. Today once I open the form, the control value shows 3/20/2018(today). I did not change any setting and just put a default control to the form.

    I would suggest you try to repair your office or update to latest version to check if the issue still exist.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, March 20, 2018 9:27 AM

All replies

  • Hi Rich,

    Just to clarify, are you using an ActiveX Date Picker Control or the built-in Date Picker you would see when you click on a Date Textbox on a Form?

    Wednesday, March 14, 2018 5:02 PM
  • DTPicker object ??

    Text Box Text31 shown above has no control source and is on an unbound form.


    If this post answered or helped you find the answer to your question, please mark it as such for other Forum users knowledge.



    • Edited by DriveEV Wednesday, March 14, 2018 5:15 PM
    Wednesday, March 14, 2018 5:05 PM
  • Using ActiveX Date Picker control.  (exact version is in the subject of this thread)

    Thanks for any help you can offer.

    Wednesday, March 14, 2018 5:44 PM
  • More specifically, when I click on the object, the Property Sheet shows....

    OLE Class - DTPicker

    and the Class shows...

    MSComCtl2.DTPicker.2

    Wednesday, March 14, 2018 5:46 PM
  • Might I ask why you are using an ActiveX control? See https://www.devhut.net/2017/06/17/great-access-tools-calendar-controls/ for some great alternative that won't suffer from versioning issues, etc.

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Wednesday, March 14, 2018 6:00 PM
  • I'm not so sure this is a versioning issue.  I was just documenting the version of the date picker ActiveX control that Access 2013 provides at.  If there's a simple 3rd party tool that will work seamlessly with the scenario I described, that would be great.  But it just seems like such a common task to open a form with this object and simply have it default to today's date that I was hoping there's some easy answer using Microsoft-supplied objects.

    Once again, the form is not bound to a table that has a date field, so a text box bound to such a table field is not an option.  All that's really needed is a user-friendly object that will work easily with an MS Access form, and I can set it to a date value (today or otherwise), and read the user's selected date value.

    Wednesday, March 14, 2018 6:30 PM

    • Edited by DriveEV Thursday, March 15, 2018 2:46 PM
    • Proposed as answer by Terry Xu - MSFT Wednesday, March 21, 2018 8:30 AM
    Thursday, March 15, 2018 2:28 PM
  • Hello rich30005,

    I failed to reproduce your issue. I tried to add a Date & Time Picker Control to a new blank form and saved it yesterday. Today once I open the form, the control value shows 3/20/2018(today). I did not change any setting and just put a default control to the form.

    I would suggest you try to repair your office or update to latest version to check if the issue still exist.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, March 20, 2018 9:27 AM
  • Ran into a new problem when I asked another user to Try the app and it crashed Access altogether.  I gave up and opted for a simple text bow with the format property set to Short Date.  Looks pretty good and the oddball issues went away in all environments I need to run in.

    Thanks to everyone for all the feedback.

    Tuesday, March 20, 2018 7:43 PM
  • Hello Rich30005,

    I'm glad to hear that you have solved the issue. I would suggest you mark any helpful reply or your solution as answer to close this thread. If you have any other issue, please fell free to post threads to let us know.
    Thanks for understanding.
    Best Regards,
    Terry



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 21, 2018 8:31 AM