• Decipher Code

    Author
    Topic
    #458888

    Hello, I am looking for some guidance on a piece code that I have inherited and am trying to use in a fresh application please. In short I have an existing form that has a calendar control that becomes visible on a button click next to a date field control, default date is today but that is then changed to that selected on the calendar control. On exiting the cal control becomes not visible. Here is the code:

    Private Sub tglSearchDate_Click()
    CalSearchDate.Visible = tglSearchDate
    If IsNull(SearchApptDate) Then SearchApptDate = Date
    CalSearchDate.Value = SearchApptDate

    If CalSearchDate.Visible = False Then
    If Not IsNull(SearchApptDate) And IsNull(SearchSortOrder) Then SearchSortOrder = “Next Appointment”
    End If
    End Sub

    where tglsearchdate is the button
    calsearchdate is the calendar
    seacrhappDate is the date field

    When I try to use this on my application the ‘calsearchdate.visible’ does’nt recognise the method/object assigned, and to be honest neither do I becuase I only thought it could be true or false.

    Thanks, Darren.

    Viewing 1 reply thread
    Author
    Replies
    • #1155446

      Are you using a toggle button or a command button ? The code is written for a toggle button.

    • #1155447

      The value of the toggle button is either True (if it is “down”) or False (if it is “up”) so you can set the value of the Visible property of the calendar control to the value of the toggle button.

      You need to have a reference to the Microsoft Calendar Control 11.0 library (11.0 is for Office 2003, it’d be 9.0 for Office 2000, 10.0 for Office XP and 12.0 for Office 2007).

      • #1155450

        The value of the toggle button is either True (if it is “down”) or False (if it is “up”) so you can set the value of the Visible property of the calendar control to the value of the toggle button.

        You need to have a reference to the Microsoft Calendar Control 11.0 library (11.0 is for Office 2003, it’d be 9.0 for Office 2000, 10.0 for Office XP and 12.0 for Office 2007).

        Here in a lesson! Thanks guys, I was using a button.

        Cheers, Darren.

    Viewing 1 reply thread
    Reply To: Decipher Code

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: