Calendar Control-How to get to "Click" event?

G

Gdareos

I'm trying to use the Calendar control for the first time, and find
the tutorial from Microsoft easy to follow except for the "NOTE: You
will have to open up one of the listed events and then change that
event to the Click event." I opened up the "On Updated" event, but
now I don't know how to change it to the desired "Click" event.

Any help would be very much appreciated.

Thanks,
George
----



Add the following code to the Click event of the Calendar control.

NOTE: You will have to open up one of the listed events and then
change that event to the Click event.

Private Sub Calendar_Click()
' Set OrderDate to the selected date and hide the calendar.
OrderDate.Value = Calendar.Value
OrderDate.SetFocus
Calendar.Visible = False
End Sub
 
E

Evi

It isn't in Properties but just click the Code button to open the form's
code page.
In the top-left dropdown box, choose the Calendar control by its Name as the
name appears in Properties. In the top-right dropdown choose OnClick.

Another peculiarity
If you wanted - for example - have the calendar control (I've Named it
CtlCal) go to the current date when you open the form, you need to put an a
SetFocus

Private Sub Form_Open(Cancel As Integer)

Me.ctlCal.SetFocus

'this is needed or it won't work

Me.ctlCal = Date

End Sub



If you want to 'click' the date into a field called MyDate then this is
simpler



Me.MyDate=Me.ctlCal



Evi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top