Using Calendar in a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • spiderz78
    New Member
    • Feb 2008
    • 10

    Using Calendar in a form

    hi all of you. My question is that I have a form with textbox to input the date then when click OK,it process the date.I want to put calendar instead of textboxes,so that the user can select the date in the calendar and not to input the date in the textbox.Thanks in advance if anyone can answer my question
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    I think access has the date picker control. Its really easy to use

    Comment

    • spiderz78
      New Member
      • Feb 2008
      • 10

      #3
      Thank you,but can you explain me how to use it.because I have try Calendar control 9.0,can you expalin me hoe to do it.thank you in advance

      Comment

      • Delerna
        Recognized Expert Top Contributor
        • Jan 2008
        • 1134

        #4
        Presume that the callenday control is called ctlCalendar.

        The user selects the date they want to use on the control
        when you need to retrieve the date they have chosen it will be stored in
        ctlCalendar.val ue. So depending on the method you were using to get the date from the textbox.value, you just need to say ctlCalendar.val ue instead.

        Comment

        • spiderz78
          New Member
          • Feb 2008
          • 10

          #5
          Thank you very much.But i have another issue.I have already created the calendar,in fatc i have created two calendar one for the "From Date" and the other one for the "To Date".Now I want the Calendar to b hidden in a combo box.so the user just Click on the Combo box and he get the calendar to input the date.thank you in advance for replying

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            Sorry, but you can't "hide" a calendar control in a combobox! What you can do is to make the calendar invisible until the user doubleclicks the textbox that the date will go into. Here's the step-by-step to do that. You have to substitute your own names, of course, and follow this same routine for each of your calendars.

            YourTextBoxName is the name of the box that will hold the date.

            YourCalendarNam e is the name of your calendar.

            First, place the calendar where you want it to appear on the form.

            Next, select the calendar and goto Properties--Format and set Visible = No

            Then place this code in the form's code module:
            [CODE=vb]Private Sub Form_Load()
            YourCalendarNam e = Date
            End Sub [/CODE]

            [CODE=vb]Private Sub YourCalendarNam e_Click()
            YourTextBoxName = YourCalendarNam e
            YourTextBoxName .SetFocus
            YourCalendarNam e.Visible = False
            End Sub[/CODE]

            [CODE=vb]Private Sub YourTextBoxName _DblClick(Cance l As Integer)
            YourCalendarNam e.Visible = True
            End Sub[/CODE]
            Now, when your user DoubleClicks on the textbox where the date will go, the calendar will appear. The date is picked, and the calendar disappears!

            Linq ;0)>

            Comment

            • spiderz78
              New Member
              • Feb 2008
              • 10

              #7
              Thank you very much!it work!Thank you again

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                Glad we could help!

                Linq ;0)>

                Comment

                Working...