Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar control (2003)

    I am using the calendar control and when I click on a different date I want a new form to open with the date the user clicked at the top of the form. I cant find where to put a on click procedure in for the days. Any help is appreciated.

    Thanks,
    Nick

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

    Re: Calendar control (2003)

    Open the form in design view.
    Select the calendar control.
    Activate the Event tab of the Properties window. You won't see an On Click event, but don't worry.
    Click in the On Updated event and select [Event Procedure] from the dropdown list.
    Click the ... button to the right of the dropdown arrow.
    In the Visual Basic Editor, you'll see something like

    Private Sub Calendar0_Updated(Code As Integer)

    Select Click from the Event dropdown list in the upper right corner of the module window. (Yes, it is available here).
    You can now write code.

    Note: you might prefer the After Update event. Click also occurs when a user clicks a second time on the same date. After Update only occurs if the user clicks on a different date.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar control (2003)

    How to I reference the date I click on. The actual date is a value in the properties box, but I dont know how I call it out in code.

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

    Re: Calendar control (2003)

    It seems reasonable that the Value property of the Calendar control is the selected date.

  5. #5
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar control (2003)

    i see that, but i couldnt figure out how to reference that in the code. here is what i have:
    Private Sub Calendar0_AfterUpdate()
    txtdate.Value = calendar0_value
    End Sub

    i am trying to fill in a text box with the date that i click on

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

    Re: Calendar control (2003)

    Since you use txtdate.Value, wouldn't it be reasonable to use calendar0.Value too? calendar0_value makes no sense.

  7. #7
    2 Star Lounger
    Join Date
    Jun 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar control (2003)

    I thought you had to reference the values in the calendar with an underscore. Oops
    Thanks,
    Nick

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

    Re: Calendar control (2003)

    Why? I don't know of any control where you have to reference the value with an underscore. <img src=/S/scratch.gif border=0 alt=scratch width=25 height=29>

Posting Permissions

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