Discussion Locked

MS Access 2000 Command Buttons

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How can I creat a command button to open and activex control such as calendar to enter a date in a date/time field?

5 replies

by dklippert

Use Tools>ActiveX Controls Calendar Control.
For a Command button use the Toolbox. It's the Hammer and Wrench icon on the Standard tool bar.

by richtee

Add the activeX Calendar to your form ? for this example, name it ?axcStartDate?

Add a command button to your form ? for this example, name it ?cmdStartDateCal?

Add an unbound Text Box control to your form ? for this example, name it ?txtStartDate?

Put the following code in the Form Load event

Private Sub Form_Load()

DoCmd.Maximize
axcStartDate.Visible = False
End Sub

Put the following code in the Command button OnClick event:

Private Sub cmdStartDateCal_Click() 'make StartDate Calendar visible and open to today?s date

axcStartDate.Value = Now()
axcStartDate.Visible = True
End Sub

Put the following code in the Calendar?s AfterUpdate event:

Private Sub axcStartDate_AfterUpdate()
'set Start Date

txtStartDate.Value = axcStartDate
axcStartDate.Visible = False
End Sub

You can now take this further in many different ways. Good Luck. Rich

This discussion is closed to new replies.