4/4/2011 5:25:04 PM
Date Picker and Calendar Seminar
By Richard Rost
A few people have emailed me recently to say that they get an error message with Access 2010 when they load up the sample database file for the Access Calendar Seminar:
"Your Microsoft Access database or project contains a missing or broken reference to the File MSCAL.OCX version 7.0. To ensure that your database or project works properly, you must fix this reference."
The file, MSCAL.OCX, is a control object that you can embed into your forms to allow someone to pick a date from a mini calendar. It was necessary in Access 2003 and before. Access 2007 and 2010 don't really need it because you can create a date field and when you click on it you get an automatic date picker control. It's now BUILT IN to Access 2007 and 2010. So, Microsoft stopped shipping MSCAL.OCX with Access 2010.
We've been talking about this in the STUDENT FORUM for the Access Calendar Seminar class, but in case you missed it, here's a summary of those discussions:
Microsoft listed the Calendar OCX Control as one of the things that were removed from Access 2010. So if you're using 2010, you'll get an error message when you first open the sample class database.
The GOOD news, however, is that YOU DON'T NEED IT. The only reason I used the OCX control in class was to give Access 2003 (and earlier) users a form to pick a date with. Now, Access 2007 and 2010 come with a Date Picker automatically built in. Just click on ANY date field, and you can pick a date. So, Access 2010 users, just ignore the lesson where I build the Date Picker form.
From Microsoft's Web Site:
"The Microsoft Calendar control (mscal.ocx) is not available in Access 2010. An alternative is to use the date picker control in Access 2010. Opening an application from an earlier version of Access where the control was used will generate an error message in Access 2010 and the control will not appear."
Apparently, Microsoft isn't shipping the good old Calendar Control with Access 2010. That control has been around since Access 2.0, and I'm sad to see it go. However, there are several different things you can do in Access 2010 to show a calendar... and most of these are built right into Access (no longer a separate control).
Here is a link to MSDN that discusses some alternatives for the calendar control.
I plan on addressing this in more detail in a forthcoming lesson that I will add on to the Calendar Seminar. I'll show Access 2010 users specifically what you can do to create a similar look and feel to the old calendar control.
In the mean time, if you want to use my sample database from class without that error message coming up, just remove the reference to MSCAL.OCX.
Open the database. Ignore any warning or error messages. Go into design view of the Date Picker form. Go to the Form Design Tools > Design tab. In the TOOLS group, click on View Code. That will bring up the Visual Basic Editor.
Click on Tools > References. Uncheck the box next to Microsoft Calendar Control. Click OK.
Now save your database. The Calendar Control reference is now gone. You won't be able to use the Date Picker form, but like I said before, you don't really need it.
You can create date pickers from standard text boxes that are date fields. If your text box is BOUND to a date/time field, you should automatically get a date picker (little calendar box) when you click on the field. If you have an UNBOUND field, just set the format of the box to Short Date (or any other valid date type), save and reopen the form and you should also see the Date Picker box.
See how easy?
UPDATE: I have released a custom replacement for the DATE PICKER.
Keywords: mscal.ocx calendar control missing