By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,560 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,560 IT Pros & Developers. It's quick & easy.

Flexible use of Leban's calendar control

P: n/a
DFS
Probably someone else has done this, but I figured out a [fairly] flexible
way to use the Leban's calendar, such that you don't have to write code in
the DblClick event each time you want to use the control. This method works
with one date field at a time, ie a start date with no end date. If you
want to use the control to fill in a start/end range, you need to write code
in the DblClick event of the start date and specify the field names.

Anyway...

In a module (called mine modCalendar)

Declarations
Public mc As clsMonthCal

Public Function showCalendar(frmName As String)

'instance of the calendar class
Set mc = New clsMonthCal

'Set hWndForm Property
mc.hWndForm = Forms(frmName).hWnd

'add date to screen (dtStart is a global in my system)
dtStart = Date
If Not IsNull(Screen.ActiveControl) Then dtStart = Screen.ActiveControl
If ShowMonthCalendar(clsMC:=mc, StartSelectedDate:=dtStart) = True Then
Screen.ActiveControl = dtStart
End If
End Function
Now from the calling form or subform, add =showCalendar("PARENT_FORM_NAME")
to the DblClick event in the Properties dialog. Works well if you have a
bunch of forms with grids of dates.


Dec 10 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.