Databases - Calendars and Dates
Calendars and Dates - how trivial ... all applications seem to use these.
Too bad they're so difficult to figure out.
It appears that Microsoft XP provides 2 controls via its Common Controls
Library - C:\WIN98\SYSTEM\MSComCt2.OCX -
DateTimePicker and MonthCalendar.
That file missing in Windows Vista.
MS Access
2007
97
| Delphi
MS Access 2007
Starting with MS Access 2007, the date/calendar functionality is built in and
there is no longer a need for a separate ActiveX component.
- Place a text box on the form
- Format it to display dates
- Enable the display of the Date picker
When the user clicks inside the text box, a calendar icon will be displayed
to the right of the text field. When the icon is clicked, the calendar will be displayed.
MS Access 97
There are 3 calendar controls.
They can be added to a form via either of 2 methods
- In the Toolbox, click the More Controls icon
and select the control from the list. The associated filenames
are not listed.
- From the menu, select Insert / ActiveX Control....
This list is easier to use and the associated filenames are listed
... except for controls implemented via COMCTL32.DLL
(and perhaps a few others).
The following lists the controls (and their libraries) to select from the list.
- MonthView - places a single month on the form
- Select - Microsoft MonthView Control
c:\win98\system\MSComCt2.OCX
- DTPicker - a ComboBox Calendar control
- Select - Microsoft Date and Time Picker Control, Version x.x
c:\win98\system\MSComCt2.OCX
- Calendar - another single month calendar
- Select - Calendar Control x.x
c:\win98\system\MSCAL.OCX
Though the default parameters are obviously different,
the Microsoft
MonthView and DTPicker controls appear to be identical to the Delphi
TMonthCalendar and TDateTimePicker respectively.
Of course, nothing is quite as simple as this,
I suggest that you read my
MS Access - Calendar Example
before trying to do this on your own.
Delphi 5.0
On the Win32 tab, Delphi 5 provides
- DateTimePicker
- This attaches a calendar to a combo box -
just click the down arrow to see the calendar.
- MonthCalendar
- This displays a calendar on the form.
Apparently, these functions are implemented via the Windows Common Controls
library.
In addition,
a few calendar type functions are implemented via Kernel 32.
In order for the user to set both the date and time requires 2
DateTimePicker's. On one of them, set the kind property
to dtkTime (the default is dtkDate).
var
dt : string;
begin
dt := DateToStr(DateTimePicker1.Date) + ' ' + TimeToStr(DateTimePicker2.Time);
Author: Robert Clemenzi -
clemenzi@cpcug.org