Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar Control no onclick() (2000)

    I've placed version10 of the Calendar Control on a form, and call it from a button on my main form...
    It opens up lovely, all in pretty colours... <img src=/S/bow.gif border=0 alt=bow width=15 height=15>

    If i right click on the calendar control and select properties, i don't get an onlick event, although i have a sample database where in the code, there IS an onclick event ! soo.. i know it can be done.

    On my main form i have a StartDate, and Endate date boxes, i have placed a small button next to each date field, each button opens up the Calendar form. (only 1 form)

    So in code, i need to determine which button was pressed , the user selects a date, and that date enters the correct date field, start date, or end date...

    So, anyone know how to find this missing on_click() event missing from the calendar control.... <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control no onclick() (2000)

    Steve, you can find the On_Click event in the VBA module.

    Open the form in design and go to the forms module.
    Click on your cal control to highlite it.
    At the top right just under the menu bar should be a dropdown menu with a list all events.
    Here you should find the on click event.

    Your second question.
    Heres how I do mine.

    Place an unbound text in the footer of your form, name it txtTemp or something. (you can make the form footer invisble, so it can't be seen)

    With the calling button ( I presume calling the same cal control) place a line which states:

    Me.txtTemp = "TempStartDate" for the start date and Me.txtTemp = "TempEndDate"

    Now when you press each button, the text as above should correspond.

    Once you've sorted the click event, you can add some code similar to the following, to determine which text recieves the dates:

    If Forms!frmYourFormName!txtTemp = "TempStartDate" Then
    Forms!frmYourFormName!StartDate= Me.YourCalendarName.Value
    Forms!frmYourFormName.Requery
    End If
    If Forms!frmYourFormName!txtTemp = "TempEndDate" Then
    Forms!frmYourFormName!EndDate= Me.YourCalendarName.Value
    Forms!frmYourFormName.Requery
    End If


    This is only a crude way but effective when error handling is in place.
    You can add different code for the forms open event etc, ensuring the date fields are never blank.

    Post back if further help is needed.

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

    Re: Calendar Control no onclick() (2000)

    Steve,

    Dave has given clear instructions how to create an OnClick event procedure for the Calendar Control.

    The reason that you don't see it in the properties window is that the Calendar Control is not a native Access control, but an ActiveX control. Therefore Access "knows" less about this control than about, say, a list box.

  4. #4
    3 Star Lounger
    Join Date
    Sep 2002
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar Control no onclick() (2000)

    Hmm clear to you Hans <img src=/S/artist.gif border=0 alt=artist width=34 height=29> us Newbs have more trouble... <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

    heh, Found it. Thanks very much Dave.

    Gonna try using the calendars, Tag area to hold the information, if not will default to the text-box-used-as-variable idea..

    Many thanks

    <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>

Posting Permissions

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