Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007

    Unanswered: Cannot set default value for ActiveX Date/Time Picker on form open

    I have 2 MS Date and Time Picker Controls on a form. In the properties box I can set the Value which will display when the form is opened. Is there really no way to have the control display the current date when the form is opened?

    I tried

    Private Sub Form_Open(Cancel As Integer)
    '***Set the initial dates
        Form_Notification_Generator.dpEffDate.Value = Now
        Form_Notification_Generator.dpExpDate.value = Now + 30
    End Sub
    When the code is executed, I get a run time error stating that the property is Read Only. I do not understand why the same control used in MS Excel allows me to set the value in this way but Access won't.

    I am using Office 2000..

    Any Ideas or suggestions?
    Last edited by Brent Blevins; 06-19-07 at 17:32.

  2. #2
    Join Date
    Jun 2005
    Richmond, Virginia USA
    Provided Answers: 19
    Simply try:
    dpEffDate.Value = Now
    dpExpDate.value = Now + 30

    Works for me in ACC2000!
    Hope this helps!

    The problem with making anything that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Jun 2007
    Thank you for your response. My code was triggered by the Form Open Event instead of the Form Load event. Apparently it makes a difference!!

    Thanks again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts