A car hire company uses this form to enter data.
Is there an easier way to enter dates on the click of a button? Yes, using the calendar control.
1. Set up the form above and in design view enlarge it to 15 cm wide and 6
cm high.
2. In Form design view click on Click on Insert, ActiveX Control, Calendar Control
10.0 (In older versions of Access it will be Calendar Control 8.0 or 9.0.)
3. A calendar appears with today’s date selected. Slide it over to the
right of the form.
4. With the calendar selected click on Properties and the Other tab. Note the
name of the calendar control. It will probably be Calendar1.
5. Right click on the calendar and choose Properties. Click on the Event tab.
6. Select On Updated and click on the three dots icon.
7. Select Code Builder and OK
8. The Visual Basic editor screen will load. In the top right is a drop-down
box labelled Updated. Click on it and choose Click.
9. Type in Me.DateOut = Calendar1.Value
10. Save and close the Visual Basic Editor. Go into Form view and test that when you click on a date, it appears in the DateOut text box.
Always starting with today’s date
When the calendar loads the date selected is the date that you first set up the calendar on the form. To make sure that it sets only today’s date.
1. In Form Design View load the Form Properties.
2. Go to the Event tab.
3. Click on On Load. Select the three dots icon and choose Code Builder.
4. Enter this code: Me.Calendar1.Value=Now()