Calendar.mdb and CalendarNoOCX.mdb

These two databases demonstrate how to build a "universal" calendar control form that you can call from any control on a form that requires a date or date/time value.  The essential ingredients are:

1) frmCalendar

2) Public Function GetDate

To invoke the calendar function in either example, call GetDate and pass it the control *object* that you want the calendar to update.  You can do this directly from a control's Double Click event (the sample forms are "wired" this way) or from the click event of a companion command button.

Calendar.mdb
In this sample, frmCalendar uses the Calendar OCX to drive the date values.  The GetDate function opens frmCalendar and tells it the control it must update by calling a public sub as a method of the form.  (This also demonstrates a creative use of the form's class module code.)

CalendarNoOCX.mdb
For those of you who must install across multiple platforms (particularly using the Runtime), this version does not depend on the Calendar OCX that can cause version problems.  In this version, frmCalendar can also return a time value.  Ask for the time value by supplying a second optional parameter:

GetDate(<control object>, 0)

In this version, frmCalendar uses a rather crude but effective Option Group and a lot of code to emulate what the Calendar OCX does.

Enjoy,
John Viescas
Viescas Consulting, Inc.
http://www.viescas.com/