Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > Courses > Access > Developer > D50 > < D49 | D51 >
Back to Access Developer 50    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Classes with Events
Gary James 
      
5 months ago
Will you be covering classes with events any time soon?
Richard Rost  @Reply  
           
5 months ago
Classes with user-defined events... Yep... Coming up soon.
Gary James OP  @Reply  
      
5 months ago
Richard, this might be a good time to revisit the topic I brought up last year, shortly after your recovery. I’ve since discovered a powerful technique that Access developers can use to simplify inter-module communication: a singleton class module with events.

This approach reduces system design complexity by allowing forms to communicate changes to shared tables through events. When a form modifies data, it can trigger an event tailored to the type of change. Other forms listening for that event can then update their displays automatically—without the initiating form needing to know anything about which modeless forms are currently open.
This technique is also useful in designs where a main application form includes a status bar that displays context-sensitive Help for any popup forms or controls that gain focus.

The mechanism works because a public singleton class object is instantiated when the application loads. Then, whenever a form opens, a few lines of VBA in its Open event assign a local WithEvents variable to the public class object. This hooks the form into the event chain, effectively making it a listener for any events raised by the singleton.

The developer defines the number, type, and parameters of these events. Any form can trigger an event by calling a public method on the singleton, and all other hooked forms will receive it. Events with custom arguments can instruct listeners to refresh or reload their displays—especially useful when multiple forms share a table referenced in the event parameters.

An example of this can be seen in the small Access program on GitHub:
https://github.com/NfaToys/Global-Messaging-Events-Class/blob/main/Event%20tests.accdb
Gary James OP  @Reply  
      
5 months ago

Gary James OP  @Reply  
      
5 months ago
Here's a new GitHub source files path.  This was created using the Version Control Add-In for Access.
https://github.com/NfaToys/Global-Messaging-Events-Class/tree/main/Event%20tests.accdb.src

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer 50.
 

Next Unseen

 
New Feature: Comment Live View
 
 

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: 1/15/2026 11:00:02 AM. PLT: 1s