Calendars for MS Access - Keep Date and Time Formats Uniform in All Tables

Calendars for MS Access - Keep Date and Time Formats Uniform in All Tables
Page content

Calendar for Data Entry in Forms

People input dates in so many different formats – month first, day first, days with a three-letter month name and then the year. The year may be in two digits or four digits and so on. Then, the variations in formatting characters add another dimension of difficulty. The day, month and year may be separated by the slash character, by blanks or by hyphens when you use a number for the day, a three character month name and then the year format.

You could write data validation code, of course, but then writing validation code for all these variations and then testing them for correctness will consume a significant chunk of development time. It would be completely safe and robust if the user was required to pick the date from a calendar of the current month that could change to earlier/subsequent months as required. Dates can be entered in just one valid form. What you need then is a pop up calendar for one month, starting with the current month, next to the field that is to be populated by a date. Once a date is chosen, the calendar is closed and the date clicked on gets entered. MS Access 2003 as well as 2007 versions provides you with a means to do just that.

Access 2003 Pop-Up Calendar

Access 2003 provides a calendar control that can be used to display or enter a date in a form, a report, or a data access page. The calendar control is an ActiveX control. One could obtain an Active X control from third parties, too. When using it, you need to be aware that there are security risks involved in using ActiveX controls. Make sure the controls are from a source you can trust.

Start with the form, report or data access page by opening it in the design view. Choose the calendar control via the toolbox, go to “more controls”, and then “calendar control”. You need to resize if necessary and move the control to the desired location. Most often this location would be right next to the data box where you want the date to be entered.

There is a property sheet associated with the control. These properties can customize the pop up calendar’s look and attributes. Name, ControlSource, Value, Day, Month, FirstDay are some key properties available. Help is available that explains the exact effects these key parameters have. Set them as per your requirements. You can manipulate these parameters progra,matically, too. but then that is for developers skilled in VBA and other programming languages. Look up Using the calendar control in Access and Improving the Usability of the Calendar Control in Microsoft Access for further details.

.

Example 1

Another Example

Access 2007 Calendar

Microsoft Access 2007 has an Auto Calendar that displays a pop up icon. The icon is displayed when a field defined as a date/time type is clicked on for data entry. You then click on the icon to get the calendar and choose your dates for entering into the field. When you click on the auto calendar icon, a calendar is displayed, allowing you to choose your data. This auto calendar would be enabled when during table design view you choose a field to a date/time type. This calendar or the “date picker” can be enabled or hidden by setting the date picker “for dates” or “never”.

.