Versions: 97 +
Without doubt, the most commonly searched for term on this website is calendar control. Seems to me that this is a lot of fuss about nothing. The majority of developers just want to be able to trigger a little form from within their own forms, from which a user can select a date, and for that date to then be passed back into the relevant control on the original form.
With this in mind, I've created a simple little modal form that mimics a calendar control quite nicely - it's shown below, together with its key features. This functionality is virtually self-contained, i.e. you only need one extra module to support the cross form functionality (and that just creates one global variable). In other words, all you have to do to use the Accessory Calendar Control Mimic is copy frmCalendar and basCalendar from the sample database, downloadable below, into your database and you're ready to go. What could be easier?
In case you're wondering why a module is needed in Version 2 as well as the form, this was the easiest way for me to add the much-requested support for sub-forms to the Accessory Calendar Control Mimic.
The sample includes a simple demo of how to use the Accessory Calendar Control Mimic but essentially all you do is set a global variable (ctlIn) to the control you want the calendar to populate and open the relevant form (frmCalendar). In the example below a command button called cmdCalendar is being used to launch the Accessory Calendar Control Mimic and put the date returned in a text box on the same form called txtDate.
Private Sub cmdCalendar_Click() 'Code sample from Accessory http://www22.brinkster.com/accessory/ Set ctlIn = Me.Controls("txtDate") DoCmd.OpenForm "frmCalendar" End Sub
Note regarding usageTo use the Accessory Calendar Control Mimic all you need to do is copy the frmCalendar form and basCalendar module from the downloadable sample into your database. Although you are free to use, modify and/or redistribute said form as you wish, please always leave the header referencing Accessory within the underlying VBA. Not only is this courteous, it's also good programming practice to cross-reference your source. Thanks.
Help keep The Accessory Calendar Control Mimic free...
Access 2000+ sample database, including the Accessory Calendar Control Mimic form and examples of how to use it (36KB)
Access 97 sample database (14KB) (as above but untested really, as I don't have A97 any more)
You'll need unzipping software for these download, such as WinZip.