Roger's Access Library Homepage
Forum Home Forum Home > Other Download Libraries > MS Access MVP Libraries > Long, Crystal
  New Posts New Posts RSS Feed - Popup Calendar, works in Access 2007+ & lower too
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Please consider donating $1 per sample downloaded, (find out why here)

Popup Calendar, works in Access 2007+ & lower too

 Post Reply Post Reply
Crystal Long View Drop Down
Microsoft MVP
Microsoft MVP

Joined: 21 May 2012
Location: Colorado
Status: Offline
Points: 35
Post Options Post Options   Thanks (0) Thanks(0)   Quote Crystal Long Quote  Post ReplyReply Direct Link To This Post Topic: Popup Calendar, works in Access 2007+ & lower too
    Posted: 27 Jun 2012 at 4:42pm
explodes into an Access 2007 database and a ReadMe text file.

thanks to Brian Keanie for testing the Access 2000 conversion with Access 2003 (added Jan 2015)

links to a related calendar report tool and a popup calendar that works with earlier versions of Access are at the bottom

Popup Calendar that works with Access 2007 and above!

No ActiveX controls. Everything is built using basic Access controls. The design and code are open.

Popup Calendar by Crystal

f_PopupCalendar_Test loads automatically when this database is opened.  It is not needed for the calendar -- it is only in the database as an example of how to use the popup calendar.

To use the popup calendar in another database, import:
... all the code it needs is behind the form
COMPILE THE CODE BEFORE YOU RUN IT! The database is not compiled.

the first time you open this:

1. CLOSE the test form that automatically opens
2. press ALT-F11 to go to the VBE (Visial Basic Editor)
3. from the menu, choose --> Debug, Compile...

'~~~~~~~~~ Compile ~~~~~~~~~
Whenever you change code, references, or switch versions or operating environment, you should always compile and save before executing.
from the menu in a VBE (module) window: Debug, Compile
fix any errors on the yellow highlighted lines
keep compiling until nothing happens (this is good!) -- then Save

I usually assign this Double-Click [Event Procedure] to each date control:
  DoCmd.OpenForm "f_PopupCalendar"

the popup calendar reads the ActiveControl to get date and, optionally, time if it is filled out.  When OK is clicked on the popup calendar, the control you came from is updated with what was chosen.

Switching to other dates is quick.  There are built-in buttons for:
  •  back one day
  •  forward one day
  •  back one week
  •  forward one week
  •  back one month
  •  forward one month
  •  back one quarter
  •  forward one quarter
  •  back 6 months
  •  forward 6 months
  •  back one year
  •  forward one year
  •  back 10 years
  •  forward 10 years
  •  Today
  •  and ANY specified number of days you wish ... positive or negative
UNDO changes you have made in the calendar by clicking the RESET button
if you click OK by mistake, just press ESCape when the form closes to undo changes to the control

You do not have to test for a weekend, all the days can be bold.  There is a parameter in the procedure that colors the controls to determine if weekends will be treated differently.

If you are using the popup calendar to collect information for something else, you can send an OpenArg with a date and the ActiveControl stuff will be skipped.  This is not tested ... the logic is in there and commented.

This has tons of uses and other applications with slight modification.  I have a version of this that checks to see if the calendar is being used as a subform and if so, it sets Visible and Left for buttons with something particular in the Tag, and changes the form width. 

I have included a procedure to Update External Forms, and it is called every time the calendar is set.  This makes it easy for you to hook the calendar in to your application.

The numbers are in the upper left of each day to give room for Labels, Textboxes, or something else to show on each day.  If you wish the days to be centered on each day, edit the Set_DefaultFormat sub. You can change the colors that Today and the Pick day use by editing Mark_TodayAndDate

The Calendar that is built in to Access works great -- as long as the date you want is close to today

Access Built-In Calendar

... or maybe you would rather use THIS calendar ...

Popup Calendar -- Today is Red, Pick is blue

All the code is behind the form.  You can easily add additional buttons for increments like:
  • 25 years
  • 30 days
  • 45 days
  • two quarters
  • ... whatever you use on a regular basis.
Popup Calendar Time Controls by Mark Davis

Related tool:

Calendar Report in HTML format
by Crystal
on RogersAccessLibrary

Other versions:

For Access 2003 and below, get my PickDate download from UtterAccess
Date Picker Popup (Access 2K) posted in 2004
(you have to be signed in to download -- UA is a great forum to be part of so if you haven't joined yet, pick a username you want your friends to call you and start posting :)

Feedback is appreciated, thank you

Warm Regards,

Microsoft MVP
remote programming and training

Access Basics by Crystal
Free 100-page book that covers essentials in Access

Remote Training and Programming

video tutorials:

   (: have an awesome day :)

Warm Regards,
Microsoft MVP
Remote Training & Programming
Let's Connect and Build Together
~have an awesome day ~
Back to Top
Sponsored Links

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.