Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help, I can't get Calendar Control To Work

Status
Not open for further replies.

Poobear1929

Technical User
May 11, 2004
32
US
I have created a Calendar using calendar control 10.0 to open from a combo box. I was looking up how to do this at So far everything works great, but I can't get the Calendar to pass the date to the combo box. The Calendar opens up with the current date selected but that is it. I can't figure out how to pass the date from the calendar to the combo box. The Calendar properties doesn't have on click under events. If anyone can help me that would be great. I have been messing with this thing for the last two days and haven't gotten very far.

Poobear
 
PooBear

Your right the Calendar control doesn't have an Onclick event BUT if you go in to VBA you can create the event.

E.G

In my example my Calendar in called SelectDate, in VBA I create an event

Code:
Private Sub SelectDate_click()

GToggle = GToggle + 1
If GToggle = 1 Then
  Me.Date1.Value = SelectDate.Value
  TmpGate1 = Format([Date1], "mm/dd/yyyy")
  GDate1 = TmpGate1
ElseIf GToggle = 2 Then
  Me.Date2.Value = SelectDate.Value
  TmpGate2 = Format([Date2], "mm/dd/yyyy")
  GDate2 = TmpGate2
  GToggle = 0
  Me.Date2.SetFocus
  Me.SelectDate.Visible = False
  'DoCmd.OpenForm "Printfrm", acNormal
  Me.Printbtn.Visible = True
End If

In my example I assign the date into a textbox called Date1 its a bit rought but does what I think your getting at

Hope it helps
 
How are ya Poobear1929 . . . .

First of all the [blue]Calendar Control does have a Click Event![/blue] It just doesn't show in the Events Tab in Form Design View. In fact there are quite a few others!. To see them, goto the Form Module. In the left ComboBox, select the name of the Calendar Control, then drop the list on the right. [blue]There you'll see all the events![/blue].

Now, consider the [blue]Click & On Updated Events[/blue].

The [blue]Click Event[/blue] triggers no matter where you click on the calendar (the border for instance).

The [blue]On Updated Event[/blue] triggers when you select a day from the calendar.

cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top