MOD2000: Calendar Control Cannot Format Individual Dates (209057)
The information in this article applies to:
- Microsoft Office 2000 Developer
- Microsoft Access 2000
This article was previously published under Q209057 Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
In the Calendar control included with Microsoft Access 2000 and Microsoft Office 2000 Developer, you can change the formatting of all the text, but you cannot change the formatting of individual dates.
CAUSE
This is a design limitation of the Calendar control.
RESOLUTION
A workaround for this behavior is to use a text box on your form that
reflects the date selected in the Calendar control. The following example
demonstrates how to create such a text box:
- Open a form in Design view.
- On the Insert menu, click ActiveX Control, click Calendar Control 9.0, and then click OK.
- Change the Name property of the Calendar control to Calendar1.
- Add a new text box to the form. Change the Name property of the text box to CalendarDate.
- Right-click the Calendar control and then click Build Event. Paste the following code:
Sub Calendar1_Click ()
' This procedure sets the value of the CalendarDate text box to the value
' of the date selected in the Calendar control, with a Long Date format.
' Note that you can use the format of your choice--you do not have to use
' the Long Date format.
Me!CalendarDate.Value = Format(Me!Calendar1.Object.Value, "dddddd")
End Sub
- Close the module.
- View the form in Form view, and select different dates.
Modification Type: | Major | Last Reviewed: | 6/24/2004 |
---|
Keywords: | kbprb KB209057 kbAudDeveloper |
---|
|