Fix a List Box Click Event That Does Not Run in Microsoft Access
Question details
Determine why a list box Click event does not run the expected VBA code in a Microsoft Access database.
- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A form uses a list box event to run VBA code, potentially to show a button when the list box receives focus.
- Observed behavior
- The expected code does not execute in one database, although the control names are correct and similar code works in other databases.
Open the affected database in Access and identify the form, list box, and event procedure you want to test. If Access displays a security warning, enable content only if you trust the database and its source.
Verify the List Box Click Event and Test Its VBA Procedure
Use this method to determine whether the Click event is connected and whether its code begins running.
Open the form in Design View, select the list box, and open Property Sheet > Event. Set On Click to [Event Procedure] if it is not already selected.
Click the ellipsis button next to On Click to open the corresponding procedure in the VBA editor. Confirm that your code is inside that procedure.
Click an executable line in the procedure and press F9 to set a breakpoint, or add MsgBox "Click event fired" before the code you want to test.
Switch the form to Form View and click an item in the list box. If the breakpoint or message box appears, the event fired; inspect the subsequent VBA statements and conditions.

Use a Focus Event to Show a Button
Use On Enter or On Got Focus instead of Click when the goal is to respond to the list box receiving focus.
Recreate the Access Database If the File Is Corrupted
Try a new database if the event is configured correctly but still fails in the affected file.
Use WPS Office for Everyday Documents and Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface for working with documents, spreadsheets, and presentations. Its Microsoft Office format support makes it easy to move everyday files, but it does not repair Access databases or replace Access VBA events.

Frequently Asked Questions
How can I tell whether the list box Click event is firing?
In Design View, open the list box's On Click event procedure from Property Sheet > Event. Add a MsgBox at the start or press F9 on an executable line, then test the list box in Form View.
Why should I use On Enter or On Got Focus instead of On Click?
Use a focus event when the action should occur as the list box receives focus, including through keyboard navigation. Set On Enter or On Got Focus to [Event Procedure] on the list box's Event property tab.
Can Access security prevent the VBA event from running?
Yes. Access may disable active content in an untrusted database. Check for a security warning when opening the file and enable content only if you trust the database and its source.
What should I do if the same code works in another database?
Compare the list box's On Click property and event procedure with the working database. If the configuration is correct and the problem persists, create a blank database and import the affected database's objects to test for file corruption.
Can WPS Office fix an Access list box VBA event?
No. The event must be diagnosed in Microsoft Access. WPS Office can be used separately for compatible documents, spreadsheets, and presentations.




