Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Custom Date Picker < Overflow! | Custom Date Picker 2 >
Custom Date Picker
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   19 months ago

Build a Custom Date Picker Popup Form in MS Access


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this Microsoft Access tutorial, I will show you how to create a custom date picker form with buttons to add or subtract days, weeks, or months from a date field. You'll learn how to build and integrate a functional date selection tool that updates values with ease. We'll then return that value to whatever field you called it from.

Madeline from Elk Grove Village, Illinois (a Platinum Member) asks: I like to make my own little buttons to add days, weeks, or months to date fields, but I don't want to have to do this for every single date field in my database. Is there a way that I can make my own custom date popup picker where I can just attach this to a date field and then return the value?

Prerequisites

Links

Recommended Courses

Up Next

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsCustom Date Picker in Microsoft Access

TechHelp Access, DatePickerF, Date Picker Form, Custom Popup Form, VBA Programming, Custom Function, TempVars in Access, Form Design, ISO Date Format, Dialog Form, Developer Level Video, Default Date Value, Date Math in Access, Date Format Change, Access Form Customization, Pop-up Date Control, Date Picker Functionality, Value Returning Dialog, Custom Date Entry

 

 

 

Comments for Custom Date Picker
 
Age Subject From
20 monthsCustomer Time PickerJeffrey Kraft
20 monthsPopup Opens in the wrong placeSami Shamma

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Custom Date Picker
Get notifications when this page is updated
 
Transcript In today's video, we're going to talk about how to build a custom date picker. You can either click the button or double-click the date field or whatever you want to do. You get your own little date picker. You can have little buttons on it to add a day, add a week, add a month, all those kinds of little add up or subtract things. You hit okay and it puts the value back where you came from. We're going to talk about that in today's video.

Today's question comes from Madeline in Elk Grove Village, Illinois, one of my Platinum members. And I actually bumped this up the list a little bit because one of my moderators and friends, Sammy, has been working with an issue close to this, so I figured I'd put together a little database for it. But Madeline says, "I'd like to make my own little buttons to add days, weeks, or months to date fields, but I don't want to have to do this for every single date field in my database. Is there a way that I can make my own custom date pop-up picker where I can just attach this to a date field and then return the value?"

Well, sure, Madeline, and in fact, if you know the technique that I used in my custom message box video, this guy, where we made a custom message box. You can click yes, no, or whatever buttons you want. We can use a dialog form to return a value. You can use the same thing for a date picker or any kind of pop-up that you want.

So before we get into it, this is a developer level video. What does that mean? Well, it means we're going to be using some VBA. So if you've never done any VBA programming in Access before and you want to learn, go watch this video. It's about 20 minutes long. Teaches you everything you need to know to get started. Make sure you know how to use if-then statements. We're going to create our own function to return a value, so make sure you know how to build your own function. And make sure you've watched my tempVars video, unless you're Adam, in which case you probably haven't watched it yet. But these are all free videos, they're on my website, they're on my YouTube channel; go watch those and then come on back.

Okay, so here I am in my "TechHelp" free template. Oops, this is a free database. You can grab a copy of it off my website if you'd like to. And let's say I got a bunch of different dates in here. Here's a date field right there. Let's say the customer's got a date field here. We've got date fields on our order form. We've got date fields all over the place. And I want to be able to have my own custom set of controls.

So instead of this boring little pop-up here, right, I would like to make my own. That is a little pop-up form, and I can have little buttons to add a day, add a week, add a quarter, add a year, you know, add four, whatever. All right. You don't want to work with this; you want to make your own. I get it.

So let's see how we can do that. Let's start by putting together our own little date pop-up form. So, let's make—I'm going to copy my single F that I have here. It's just a blank single form. Copy-paste, control-C, control-V. We'll call this the DatePickerF. The date picker form, where are you? Right there. Let's go to design view. We can get rid of that ID right there, and we'll make this our date value. So we'll just put in here "date" like that. Okay. And we'll slide it up a little bit, maybe move it over a little bit like this. Maybe set the format if you want to. Well, let's give it a name too first here.

What do you want to call this thing? Let's just call it "my date," right, and the format will be short date. I like the ISO date format. I am on a mission to change the world to this date format—your month, day. It's the one that makes the most sense, and there's no ambiguity between it. Watch this video for details. After I get the world changed to this, I'm going to work on the 28-day month, but that's a whole other story. And since I have Windows set to the ISO date format, my short date should come in in that format in my Access database.

Alright, let's make this a little bit smaller, like so. Let's get rid of all the stuff we don't need because right now if we save this and take a look at it in Form View, we've got navigation buttons, record selectors, all this stuff. Let's get rid of all the stuff we don't need. So let's go to Format, click on the Form Properties here, go to Format, turn off the Record Selectors, Navigation Button, Scroll Bars. Now, I'm going to turn off the Control Box and the Close Button because I'm going to put my own OK button here that the user is going to click on, and that will close the form and do some stuff, including returning the value. I don't want them to hit the X up here, alright? Yeah, I know they can still hit Control F4, but A, most users don't know that, and B, we can intercept that key keyboard thing if we wanted to—the key press if you want to—but for now, let's not worry about that. So let's put an OK button on here, right, Form Design, grab a button, we'll put it right down here, that'll be my OK button.

Or in a Cancel the wizard, as a wizard doesn't do this, so that okay, just "OK" there. Now here's where you can put all the other little controls that you want. Let's start this date value off here with a default value of "equals date." So it'll put today's date in that box to start with. But then we can make other little buttons to change it. I like stuff like this. Watch this. Copy, paste. Let's put a little button right there. Come here. There you go. We'll put in here "+1D," like that. That'll be plus one day. Make it nice and tiny. Okay, now give this button a name. Alright, let's call it "+1D" like that, and then we'll right-click, build event, and there's my code builder, right, and here we'll say in it "my date equals my date plus one." Remember, in date math in Access, one equals one day. You want to add an hour; you can add 124th or use the date add function. And you can do the same thing for minus a day, plus a week, plus three days, plus a month, whatever. You can put all kinds of buttons in here that you want, whatever buttons you like, line them up.

So when you're all done, you've got something that looks like this. We'll center it over here where we want it, and now we can hit the plus one day, hit minus a day, plus a week, whatever. All these buttons, you get it. I've done other videos on how to do these before. In fact, here's the video for it. You can take this guy, this form that I made here, and make this the pop-up that we're doing today if you want. Look at all those different buttons. You can even pick what kind you want: month, year, whatever. The user can go and change the date, whatever you want in here. In fact, you can even use this little guy too if you want to. There's nothing stopping you from doing that. Leave that on there too. More options the better.

Okay, so what's this "OK" button going to do?

Okay, now the form has to return the value that's in that "my date" box to whoever called it. Okay, now the easiest way to do that is to use temp vars. We're going to set a temp var in here to that date, and then whoever called that form can just read that temp var. Because forms by themselves don't really return values, but this is kind of a cheat to do that. We'll make the form act like a function, right?

So, go to design view and inside this OK button, which it's Command Force. So let's call this the OK Button. OK Button. There we go. Right-click, build event. Alright, so in here, we're going to make a temp var. So, tempVars, what do you want to call it? Let's call it "DatePickerValue" equals whatever is in "my date" there. Now, you've got to say "my date dot value" because if you don't put the dot value, it's going to try to assign the object "my date" to the temp var, and tempVars can't hold objects, only values. Just saving you an error message there. Alright, enter. Now after that, we've grabbed the value. Now we have to close the form. Because when we open the form in a minute, we're going to open it as a dialog form. And that's going to stop everything else from happening until this form is closed. So do command dot close, acForm, me dot name. That just saves you a step from having to put the actual name of the form in there. Comma. And then we're gonna put ACCloseSave. Yes, there's a long story behind that. I'm not gonna go over it again. I've covered it in about 15 videos. Okay, if you're curious, post a comment.

Save this. Close it. Close it. Now, when you open up this form and hit OK, it closes it, and it saves that value in a temp var. Now, all we've got to do is open that form and then read the temp var when it closes.

Okay.

Oh, and by the way, one other trick, if you want, while you've got this thing open here, if you want to make this the default button, right-click, design view, open up its properties, go to other, set default to "yes." When the user presses the enter key, it'll push that button, right? There's a video on that one.

And hint, yes, we can add a cancel button here if you want to. We'll do that in the extended cut.

Alright, so close that, save it. Now we've got our form built where we can put a date in here and little buttons to do whatever we want. Hit OK. Now the value is saved in a temp var. Now all we have to do is make a custom function to get that value from the form when it closes and put it in whatever field we want to.

And we will do that in part two tomorrow, so tune in tomorrow, same bat-time, same bat-channel, or if you're a member, you can watch it right now because I'm going to record it in just a few minutes. That's going to be your "TechHelp" video for today. Hope you learned something. Live long and prosper, my friends. I'll see you tomorrow.

TOPICS:
Building a custom date picker in Access
Clicking or double-clicking elements to activate date picker
Custom date picker popup with date manipulation buttons
Inserting the selected date back into the form field
Developing with VBA in Access
Creating dialog forms to return values
Setting up a developer environment in Access
Programming if-then statements in VBA
Creating custom functions in VBA
Using tempVars to store data across Access forms
Designing forms in Access for the date picker
Adding and formatting date controls on forms
Customizing form properties to remove default elements
Adding and coding buttons in Access for date manipulation
Utilizing date math in Access for button functions
Saving and closing forms programmatically in Access
Using tempVars to return values from closed forms
Setting default buttons on Access forms for enter key
Navigating and utilizing the design view in Access forms
Storing selected dates using tempVars
Building a custom function to retrieve and set form field values
Continuation of the tutorial in the next video part
Quiz Q1. What is the purpose of building a custom date picker for an Access database?
A. To change the database file format
B. To modify Access security settings
C. To provide a personalized way to input dates into fields
D. To increase the storage capacity of the database

Q2. According to the video, which programming language is used for creating the custom date picker?
A. JavaScript
B. SQL
C. VBA
D. Python

Q3. Why does the instructor recommend watching the tempVars video before attempting to create a custom date picker?
A. It covers how to create a database from scratch.
B. It introduces the use of global variables, which are essential for the date picker.
C. TempVars are used to store the picked date value temporarily.
D. The tempVars video teaches how to connect to a database using ODBC.

Q4. What is the significance of setting the default property of the OK button to "yes"?
A. It makes the button appear first in the tab order.
B. It sets the button to be automatically selected when the form opens.
C. It allows the user to trigger the button by pressing the enter key.
D. It ensures that the OK button is always visible, regardless of the form size.

Q5. If you want to add one day to the current date in Access using VBA, which code snippet would be correct?
A. myDate = myDate + 1/24
B. myDate.Value = myDate.Value + 1
C. myDate = myDate.AddDays(1)
D. myDate.Value = DateAdd("d", 1, myDate.Value)

Q6. Which of the following is NOT a step mentioned in the video for creating a custom date picker form?
A. Turning off the Record Selectors, Navigation Button, and Scroll Bars.
B. Assigning the "DatePickerValue" temp var to the date picked by the user.
C. Adding a Compact and Repair button to optimize the database size.
D. Copying and pasting a blank form to start the design of the DatePickerF.

Q7. What is the next step after creating the date picker form and setting its default button?
A. Running a compact and repair on the database.
B. Creating a custom function to retrieve the date value and set it to the intended field.
C. Adding a new record to the table using the picked date.
D. Securing the form with user authentication to restrict access.

Q8. What is the purpose of setting the "my date" field's default value to "equals date" in the DatePickerF form?
A. It populates the field with random dates for testing purposes.
B. It secures the date field from unauthorized access.
C. It ensures that the field displays the database creation date.
D. It initializes the field with today's date as a starting point.

Answers: 1-C; 2-C; 3-C; 4-C; 5-B; 6-C; 7-B; 8-D;

DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/17/2025 11:57:36 PM. PLT: 1s
Keywords: TechHelp Access, DatePickerF, Date Picker Form, Custom Popup Form, VBA Programming, Custom Function, TempVars in Access, Form Design, ISO Date Format, Dialog Form, Developer Level Video, Default Date Value, Date Math in Access, Date Format Change, Access   PermaLink  Custom Date Picker in Microsoft Access