ACC: How to Create a Pop-Up Calendar Control on a FormID: Q190194
|
When you want to have a user enter a date value on a form, you can improve usability of the form by providing a Calendar control on the form. To reduce clutter on the form, you can simulate a feature of Microsoft Outlook by having the calendar pop up when the user clicks a button. This article describes how to create a pop-up calendar by using a combo box and the Calendar control (mscal.ocx).
Name: Calendar
Visible: No
Private Sub OrderDate_MouseDown(Button As Integer, _
Shift As Integer, X As Single, _
Y As Single)
' Show Calendar and set its date.
Calendar.Visible = True
Calendar.SetFocus
' Set to today if OrderDate has no value.
Calendar.Value = IIf(IsNull(OrderDate), Date, OrderDate.Value)
End Sub
Private Sub Calendar_Click()
' Set OrderDate to the selected date and hide the calendar.
OrderDate.Value = Calendar.Value
OrderDate.SetFocus
Calendar.Visible = False
End Sub
CD-DRIVE:\MSDS\ODESMPL\ODE\OLECONT\Actctrls.mdb
If you don't have the ODE, you can download this database from Microsoft's
Support Web site at the following address:
http://support.microsoft.com/download/support/mslfiles/ACTXSAMP.EXE
For more information about the Calendar control, search the Help Index for "Calendar Control."
Additional query words:
Keywords : kbdta AccCon FmrHowto IntpCstm KbVBA
Version : WINDOWS:7.0,97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 26, 1999