Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar control (2000/2002)

    I have a field on a form that pops up another form with a calendar control. How do I make the calendar control default to the current date?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar control (2000/2002)

    Set the calendar's value in the On Load event of the form:

    Private Sub Form_Load()
    Me.Calendar0.Value = Date
    End Sub

    where Calendar0 is the name of the control.

  3. #3
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar control (2000/2002)

    Cheers Hans

    I'd tried that in the form's open event and it didn't work <img src=/S/confused.gif border=0 alt=confused width=15 height=20> Why was that?

    Ah well, all sorted now <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar control (2000/2002)

    The On Open event occurs earlier than the On Load event; the calendar control is not "ready" then. According to the online help, the events occur in the following order when a form is opened:

    Open - Load - Resize - Activate - Current

  5. #5
    Star Lounger
    Join Date
    Mar 2003
    Location
    Ilkeston, Derbyshire
    Posts
    62
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar control (2000/2002)

    Thanks again, Hans

Posting Permissions

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