Discussion Locked

Calendar in Microsoft Access form

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I set up date field in an Access form so the user can select the date from a pop-up calendar, instead of typing it in?

7 replies

by wmurch

Thanks for your quick reply. I am using Access 97. I have looked a the ActiveX Calendar control, but I don't know how to make it "pop up" when required. Ideally I want the user to be able to enter the date manually or pop-up the calendar, select the date & have the date returned to the field.

by wmurch

Sorry, I'm not sure what you mean by DtPicker. I can't find it listed in any of the controls in Access. Is it a VBA function?

by jodybcarter

You can do this by adding the Calendar Control, a text field to hold the date value and a button to click and display the calendar.

In the form_load event, set the calendar control visible property to false. Then, in the button's click event, you would set the calendar control visible property to true. Then, you add code in the calendar control's click event to set the text in the text box to the value of the date selected in the calendar control.

Here's an example of the code:
PrivateSub Calendar_Click()
Text1.SetFocus
Text1.Text = Calendar.Value
Calendar.Visible = False
End Sub
Private Sub Command1_Click()
Calendar.Visible = True
End Sub
Private Sub Form_Load()
Calendar.Visible = False
End Sub

This discussion is closed to new replies.