Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > On Click Event Timing < Invalid Use of Null | Export to Word >
On Click Event Timing
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   4 years ago

On Click Event Timing in Microsoft Access VBA


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

In this Microsoft Access tutorial, I will teach you how and when the different On Click events fire. There's a different event for each control (text box, combo box, etc.), for each section (detail, header, footer), and for the form itself, which is a tricky one.

Links

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.

Keywords

access 2016, access 2019, access 365, microsoft access, ms access, ms access tutorial, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #learn, #lesson, #training, #database, #fasttips, Form.Click, Form OnClick, Form On Click, Detail On Click, Form Header On Click, label, text box, button, combo box, on got focus, on enter, on exit, subform

 

 

 

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 On Click Event Timing
Get notifications when this page is updated
 
Intro In this video, we will talk about how different On-Click events work and when they fire in Microsoft Access forms. We will look at the timing of On-Click events for labels, text boxes, buttons, combo boxes, and subforms, and discuss how the Got Focus, On Enter, and On Exit events differ. You will also see how the form, detail section, and header footer On-Click events behave, and learn how to test and identify which event fires with different form objects.
Transcript Welcome to another Fast Tips video brought to you by AccessLearningZone.com. I am your instructor Richard Rost.

In today's video, we are going to talk more about the On-Click event - when and how different Microsoft Access On-Click events fire. There is a form click, a section click, a combo box click, a label click. There are all kinds of different clicks. Some of them are confusing. In this video, I am going to try to explain them.

In my previous TechHelp video On-Click, we created a couple of little labels down here. You can click minus one or plus one, and the On-Click event for that label would increase or decrease the date in the Customer Since field by whatever interval you picked here: date, week, month, and so on. That is using the On-Click event in a label, which is pretty straightforward.

You can also put an On-Click event in the field itself. For example, the text box here. We can do the same thing. Right-click, Design View. Let's go to the Customer Since field. I am going to double-click on it to bring up its property sheet. Here is the On-Click event on the Events tab. I will go to the Builder button right there. That will bring up my Visual Basic Editor, and you can do the same thing in here. You can say CustomerSince = CustomerSince + 1. Every time you click on that field, it will add one date. Whether that is useful or not, that is up to you.

Let's close that. Close this. Save it. Open it back up again. Click here. It is going to increase the value by one. See that? Pretty straightforward. Buttons work the same way. The On-Click event for a button can open up another form, for example.

Combo boxes are a little trickier - these guys right here. What you might think happens is when you click on the combo box, that event runs, but that is not the case. The On-Click event does not run until you actually pick a value. It is kind of weird. You would think that would just be the After Update event, but that is not how it works.

Let's go in here. The Customer combo box right here. Go to Events. On-Click, I am just going to put in here, MessageBox "Click." Let's see what happens. Open it up. Click. You did not get anything. See? You would think that would fire the click event, but no. Now, it fires when you pick a value.

If you want something to happen when you click on a combo box just to open it up, use the Got Focus event. Got Focus happens whenever you move to that field. Go to Events and use Got Focus right here. There are also the On Enter and Exit events too. Those are slightly different, but that is a topic for a different video. I like to use On Got Focus. Right here, we will see a MessageBox "Got Focus." Now you will see how the two work.

If you want to play with the timings, just use this little trick. Just MessageBox it. So click. There is the On Got Focus event. And now the box is open. Pick a value and there is the Click event.

Subforms do use the On Enter and On Exit events. They do not have an On Got Focus event. Remember to get the subform, you have to click on the border of it. Right there. See, there is a border. That is the subform object. It is a subform control on the parent form. Not clicking in here. Now, we are on the Product Name text box, which is part of the subform. I want to get it right there so the outer subform is selected. If I double-click, you will see it says Subform up here. On the Events, you have Enter and Exit. Enter is when you enter the subform, any control on it, and Exit is when you leave. You can see how that timing works here.

MessageBox "Subform Enter." Watch this. Drop this guy down here. Now, to go back out there, drop this down, go to Exit, and now it created the Exit event. That is a box "Subform Exit." These are fired by the parent form. The parent form handles those.

So, if I am up here and I click down here anywhere, I get the subform Enter event, and now I am in the subform controls. When handed off, if I leave that subform and come back up here, Subform Exit runs. You can use those for all kinds of things to make calculations and so on when you change things and then leave that subform. All sorts of things.

Now here comes the tricky one. If you look at a form's properties, here is the form itself. There is an On-Click event for the form. Let's see when that fires. Come in here, same thing: MessageBox "Form On-Click." Save that, and let's come back over here. Close it, and open it back up again.

Now I am clicking on any of these objects. The event is not firing. I click out here in the empty area. That event does not fire. How about the title bar? No. Move from record to record? No, that is the On Current event.

What do I have to do? The form On Current event, or excuse me, the form Click event runs when you click on the record selector. It is weird, but that is what it does. So, anytime someone selects the entire record, the form Click event runs. That is not one that I think I have ever really used in a production setting, but that is what it is.

If you want an event to run here when someone clicks on the background of the form, that is going to be the detail section's On Click event. So, come over here: MessageBox "Detail On-Click." Save it, and here we go.

Click out here. Detail On-Click. If you click on any of these objects, you get the object's On-Click event. If you click on a blank space on the form, you get the detail section's On-Click event. This is the form's On-Click event.

If you have header sections, if you come out here and (whoops, wrong spot) go to Form Header/Footer. We do not use Page Header/Footer. Remember, Page Header/Footer is for printing. We do not print forms. We print reports. So we are not going to use that. We are going to use the Form Header/Footer.

There is the Form Header. Again, the header and footer sections have their own On-Click events, right there. I will just do the Form Header. MessageBox "Form Header Click." I do not know what you would use this for, but if you want to, it is there. I have used it in the past a couple times. Form Header Click.

There you go.

One quick thing I would like to point out: on Microsoft's page, if you go to the form Click event and scroll down, it says right here on a form: This event occurs when the user clicks on a blank area or record selector. That is not correct. Blank area does not work. That is the detail section's Click event.

Only the record selector event fires for the form property.

So there you go. There is your On-Click event timing Fast Tips video. Hope you learned something. We will see you again tomorrow.

How do you become a member? Click on the Join button below the video. After you click the Join button, you will see a list of all the different membership levels that are available - each with its own special perks.

Silver members and up will get access to all of my extended cut TechHelp videos, one free beginner class each month, and more.

Gold members get access to download all of the sample databases that I build in my TechHelp videos, plus my Code Vault where I keep tons of different functions that I use. You will also get a higher priority if you decide to submit any TechHelp questions to me, and you will get one free expert class each month after you finish the beginner series.

Platinum members get all the previous perks plus even higher priority for TechHelp questions, access to all of my full beginner courses for every subject, and one free developer class each month after you finish the expert classes. These are the full-length courses found on my website, not just for Access too. I also teach Word, Excel, Visual Basic, and lots more.

You can now become a Diamond sponsor and have your name or company name listed on a sponsors page that will be shown in each video as long as you are a sponsor. You will get a shout out in the video and a link to your website or product in the text below the video and on my website.

But do not worry, these free TechHelp videos are going to keep coming. As long as you keep watching them, I will keep making more, and they will always be free.
Quiz Q1. What does the On-Click event in Microsoft Access do?
A. It runs a specified action when a user clicks on a control or section.
B. It runs whenever a form is opened.
C. It always runs when a field receives focus.
D. It triggers only when a record is deleted.

Q2. What is true about the On-Click event for a combo box in Access?
A. It fires immediately when the combo box is clicked open.
B. It fires only after selecting a value from the drop-down list.
C. It fires whenever the combo box loses focus.
D. It never fires for combo boxes.

Q3. If you want code to run as soon as a combo box gains focus (but before an item is picked), which event should you use?
A. On Update
B. On Click
C. On Got Focus
D. On Delete

Q4. Which events are available for a subform control (the container for a subform), but NOT the subform itself?
A. On Got Focus and On Click
B. Enter and Exit
C. After Update
D. On MouseMove

Q5. What does the On-Click event of a form fire on?
A. Clicking any control on the form
B. Clicking the blank area of the form
C. Clicking the record selector of the form
D. Switching to a new record

Q6. Where does the detail section's On-Click event fire?
A. When you click the record selector
B. When you click a blank area in the detail section of the form
C. When you click the title bar
D. When you click any button

Q7. What is the main use for the Form Header/Footer On-Click events?
A. They have no function.
B. They fire when clicking objects only in the detail section.
C. They fire when clicking the header/footer area of the form.
D. They print a report.

Q8. Which of the following is NOT a recommended use of the Page Header/Footer section in an Access form?
A. Printing headers on forms when printing to paper
B. Adding section headers that only show on a printed report
C. Displaying information to users while they use the form
D. Printing footers on printed output

Q9. According to the video, why might Microsoft's documentation be misleading about the form's On-Click event?
A. It states that the event fires on blank areas, but it only fires on the record selector.
B. It claims the event does not exist.
C. It says it cannot be used on buttons.
D. It suggests it fires for labels only.

Q10. Which of the following is a correct statement about using On-Click events on labels and buttons?
A. Clicking a label or button can fire their respective On-Click events.
B. Only buttons can have On-Click events.
C. Labels cannot use events in Access.
D. On-Click for buttons works only if they are read-only.

Answers: 1-A; 2-B; 3-C; 4-B; 5-C; 6-B; 7-C; 8-C; 9-A; 10-A

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.
Summary Today's video from Access Learning Zone focuses on understanding when and how different On-Click events fire in Microsoft Access. There can often be confusion about the variety of objects you can attach an On-Click event to, such as forms, sections, combo boxes, and labels. I want to clarify how these events function so you know exactly what to expect when you are working inside Access.

Previously, we built a feature where clicking on a label would adjust the date in a "Customer Since" field by a set interval depending on your selection, like date, week, or month. That was a simple and straightforward use of the On-Click event in a label.

You are not limited to just labels. On-Click events can be added directly to other fields, such as text boxes. For example, you can set up an On-Click event on a text box so that clicking it increases the date by one day. This might not be the most practical thing to do, but it shows that the On-Click event responds to interaction in more places than just buttons or labels. After you save your changes, clicking the field will update its value.

Buttons behave as you would expect. The On-Click event for a button can be programmed to do things like open another form, which is the most common way to use this event.

Combo boxes introduce a layer of complexity. It is tempting to think their On-Click event fires as soon as you click to open the combo box, but that is not the case. The On-Click event actually does not activate until you pick a value from the list. If you need something to happen when the combo box first becomes active, the event you want is Got Focus. The Got Focus event triggers whenever the user enters that field. There are also On Enter and On Exit events, which work a bit differently. For most general uses, Got Focus is a good choice to respond to the combo box being selected, while the On-Click event is best for reacting to a specific value being chosen.

For subforms, things work a bit differently again. Subforms respond to the On Enter and On Exit events, not Got Focus. To work with the subform itself, be sure you are interacting with the border of the subform control, not just a field inside it. The Enter event fires when you enter the subform, and the Exit event when you leave it. You can take advantage of these to trigger actions as you move into or out of a subform from the parent form, such as running calculations or updating information.

Next, let's talk about the sometimes confusing form On-Click event. In the properties window for the whole form, you will notice the option to assign an On-Click event. However, clicking on objects inside the form, empty spaces, or even the title bar does not trigger it. Surprisingly, the only time the form-level Click event fires is when you click the record selector, which is not a situation that often calls for this event in most database designs.

If you actually want to trigger an event when someone clicks the background area of your form, you need to use the On-Click event for the Detail section. By placing code in the detail section's On-Click property, you ensure that clicking anywhere blank on the main body of the form will run your event.

Similarly, header and footer sections - such as the Form Header and Footer - have their own separate On-Click events. These can be used if you want an event to occur when someone clicks in these areas, though it is not as commonly needed.

It is also important to understand that Microsoft's documentation on this point can sometimes be unclear. For example, some documentation claims that clicking any blank area of a form will fire the form's On-Click event, but that is not entirely correct. Only clicking the record selector triggers the form On-Click event, while blank areas in the detail section require the detail section's On-Click event.

That covers the basic timing and behavior of On-Click events across the different objects you will find in an Access form. I hope this clears up any confusion and helps you design your forms with a better understanding of what events to use and when.

If you are interested in learning even more, including access to extended TechHelp video content, free beginner classes, downloadable sample databases, and more, I have membership options for every level. But remember, my basic TechHelp videos will always remain free and available to everyone.

You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.
Topic List Understanding the On-Click event in Microsoft Access

Using On-Click events with labels to adjust date fields

Assigning On-Click events to text box fields

Implementing On-Click events in command buttons

Behavior of On-Click events with combo boxes

Difference between On-Click, After Update, and Got Focus for combo boxes

Using the Got Focus event to capture combo box focus

Understanding On Enter and On Exit events for subforms

Assigning and testing subform Enter and Exit events

How the form's On-Click event is triggered via the record selector

Using the detail section's On-Click event for blank form areas

Setting On-Click events in form header and footer sections

Clarifying Microsoft documentation on form On-Click events
 
 
 

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 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/18/2026 7:28:58 PM. PLT: 1s
Keywords: FastTips Access Form.Click, Form OnClick, Form On Click, Detail On Click, Form Header On Click, label, text box, button, combo box, on got focus, on enter, on exit, subform  PermaLink  On Click Event Timing in Microsoft Access VBA