MOD2000: Calendar Control Cannot Format Individual Dates

ID: Q209057


The information in this article applies to:
  • Microsoft Office 2000 Developer
  • Microsoft Access 2000

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:

  1. Open a form in Design view.


  2. On the Insert menu, click ActiveX Control, click Calendar Control 9.0, and then click OK.


  3. Change the Name property of the Calendar control to Calendar1.


  4. Add a new text box to the form. Change the Name property of the text box to CalendarDate.


  5. Set the OnClick property of the Calendar control to the following event procedure:


  6. 
    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 
  7. Close the module.


  8. View the form in Form view, and select different dates.


Additional query words: prb

Keywords : kbdta IntpOle
Version : :; WINDOWS:2000
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: September 3, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.