Fix Access VBA WithEvents Class Not Capturing Form Load Event
Question details
An Access VBA class module using a WithEvents variable is successfully capturing the Current event for multiple forms, but it is failing to capture the Form_Load event.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Developing an event-driven VBA class module in Access to capture form events.
- Observed behavior
- The VBA class module captures the Current event correctly but does not trigger or capture the Form_Load event when the form is assigned to the WithEvents variable.
Ensure that your VBA project compiles without errors and that you have basic familiarity with Access class modules and object event properties.
Set the OnLoad Property to '[Event Procedure]' in the Class
Manually bind the form's Load event to the VBA event procedure to ensure the WithEvents class captures it.
In Microsoft Access, some events like Form_Load may not be automatically passed to a WithEvents class module unless the form explicitly knows to trigger an event procedure. By forcing the form's OnLoad property to '[Event Procedure]', you establish the necessary binding.
Press Alt + F11 to open the VBA Editor and navigate to the custom class module where your WithEvents form variable is declared.
Locate the procedure where you assign the Access form to your WithEvents variable. Add the following line of code immediately after the assignment: frm.OnLoad = "[Event Procedure]" (replace 'frm' with the actual name of your WithEvents variable).
To prevent the class instance from losing scope before the form loads, ensure you declare the class instance variable publicly in a standard module (e.g., Public myEventClass As clsFormEvents).
Place a breakpoint on the first line of your frm_Load event inside the class module. Run the standard module code to open the form and confirm the breakpoint is hit.
![Set the OnLoad Property to '[Event Procedure]' in the Class](https://res-academy.cache.wpscdn.com/upload/seo-engine-admin/2026-10-16/eb4b75b4c44f9cb97f053a22946e1bf1.png)
Discover WPS Office for Powerful VBA and Macro Capabilities
While the issue mentioned pertains to Microsoft Access databases, if your workflow relies heavily on robust VBA macro support for spreadsheets and documents, consider WPS Office. It provides comprehensive VBA support, broad format compatibility, and a lightweight, free alternative to Microsoft Office.
- 1. Visit the WPS Website: Go to the official WPS Office website to find the latest version tailored to your operating system.
- 2. Download the Installer: Click the 'Download WPS Office Free' button and save the installation file to your computer.
- 3. Install and Run: Open the downloaded installer, follow the on-screen prompts, and launch WPS Office to enjoy powerful VBA spreadsheet functions.

Frequently Asked Questions
Why do some WithEvents capture perfectly while Form_Load does not?
Events like 'Current' often trigger seamlessly because of how Access evaluates record-level states. However, the 'Load' event occurs during the form's initialization phase. If the form's OnLoad property is blank in its property sheet, Access skips raising the event to optimize performance unless explicitly instructed via VBA using '[Event Procedure]'.
How do I ensure my VBA class module stays in scope?
You must declare the instance of your class module at the top of a standard module using the 'Public' or 'Global' keyword. If you declare and instantiate it within a Sub or Function, the variable is destroyed as soon as that specific procedure finishes executing.
Can I use one WithEvents class for multiple forms simultaneously?
A single WithEvents variable can only reference one form at a time. To handle multiple forms, you should create a VBA Collection or Array in a standard module and add a new instance of your custom class for each form you want to monitor.




