Custom Calendar Control for MS Access

MS Access by default provides inbuilt functionality to pick dates using calendar control; however it lacks few basic functionalities which makes selecting a date bit difficult. For example, if you want to select a date from year 2015 then you need to navigate multiple times to select correct date since you can move only one month at a time in MS Access calendar control. Looking at this common challenge, I have developed a custom calendar control in MS Access form which makes selection of date much easier

Custom Calendar Control for MS Access

To Use Custom Calendar Control for MS Access Follow below steps:

1. Save the following attachment in your system Custom Calendar Control
2. Open the MS Access tool where you want to use this calendar control
3. Select Access from External Data menu

Custom Calendar Control for MS Access

4. Browse the file which you have downloaded and click on OK button

Custom Calendar Control for MS Access​

5. Under Forms tab select Calendar and click on OK

Custom Calendar Access VBA Control

6. You will receive a confirmation message once import is complete, click on Close to proceed

Custom Calendar Control for MS Access
Custom Calendar Control for MS Access

7. Now the Custom Calendar Control is ready to use. To use it on the existing form (here it is Form1), open the form in design mode

Custom Calendar Control for MS Access

8. Add a command button adjacent to the text box control where you want to show the selected date

Custom Calendar Control for MS Access

9. Change the following properties of Command Button

Width: 0.3
Caption: Blank
Name: cmdSelectDate

Custom Calendar Control for MS Access

10. In the Picture property of Command Button, select calendar

Custom Calendar Control for MS Access

11. Create an On Click Event Procedure of Command Button

Custom Calendar Control for MS Access

12. Click on ‘…’ to create the procedure in VBA screen

Custom Calendar Control for MS Access
Custom Calendar Control for MS Access

13. Add the following code in the click event procedure

    DoCmd.OpenForm "Calendar", acNormal
    If IsDate(txtDate.Value) = True Then
        Form_Calendar.LoadCalendarForm txtDate.Value
    Else
        Form_Calendar.LoadCalendarForm
    End If
    Form_Calendar.lblFormName.Tag = Me.Name
    Form_Calendar.lblControlName.Tag = "txtDate"

Note: In the above code txtDate is the control name where the selected date will be displayed. In your tool if this control name is different, you can replace the same in above code.

Custom Calendar Control for MS Access

14. Done, save your project and open the form

Custom Calendar Control for MS Access

15. Click on the Calendar button to select a date

Custom Calendar Control for MS Access
Custom Calendar Control for MS Access

Download Practice File

You can also practice this through our practice files. Click on the below link to download the practice file.

Recommended Articles

Hope you liked this article. Please share it with your colleagues and comment your views below.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *