Fix Microsoft Access Command Buttons Not Working
Question details
The user needs to troubleshoot and fix command buttons in Microsoft Access forms or reports that fail to execute their assigned event procedures, such as running VBA code or exporting to PDF.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Clicking a command button in an Access form or report to trigger a specific VBA event procedure or PDF export routine.
- Observed behavior
- The command button fails to run the procedure, triggers a syntax or missing reference error, or silently stops executing during a PDF output task.
Ensure you create a backup copy of your Microsoft Access database file (.accdb) before altering VBA code, modifying form structures, or compiling the project.
Verify Event Properties and Compile VBA Code
Check the button's On Click property and resolve any syntax or reference errors in the VBA Editor to ensure the code can run properly.
A common reason buttons fail is that the form's property sheet is disconnected from the VBA code, or the code itself has syntax issues blocking execution.
Open the form or report in Design View, select the malfunctioning command button, and ensure the 'On Click' property in the Property Sheet is set exactly to [Event Procedure].
Click the ellipsis (...) next to [Event Procedure] to open the VBA Editor. Confirm that the subroutine name matches the button's actual control name.
In the VBA Editor menu, click 'Debug' > 'Compile [Project Name]'. If Access highlights any code, fix the syntax error or missing reference, then save.
Return to your Access database window, switch the form from Design View to Form View, and click the button to test its functionality.

Fix OutputTo Macro and PDF Export Errors
Address specific issues that prevent command buttons from successfully exporting an Access report to PDF.
Test for Form or Report Corruption
Determine if underlying corruption in the Access form or report is preventing the command button from triggering its code.
Discover WPS Office for Your Data and Document Needs
While Microsoft Access manages complex databases, WPS Office is an exceptional, free alternative for your everyday document, spreadsheet, and presentation tasks. It is incredibly lightweight, highly compatible with Microsoft formats, and provides a familiar tabbed interface to help you stay productive without the heavy subscription costs.

Frequently Asked Questions
Why does my Access button work in the VBA editor but not on the form?
This usually happens because the button's 'On Click' property in the Property Sheet is empty instead of being set to [Event Procedure]. Without this setting, Access does not know it should trigger the VBA code when clicked.
What does the 'missing reference' error mean in Access VBA?
It means your database is trying to use an external library or object model that isn't available on your current PC. Open the VBA Editor, go to Tools > References, and uncheck any items marked as 'MISSING' to resolve compile issues.
Can I export multiple Access reports to a single PDF using a command button?
Yes. You can achieve this by using a multi-select list box to gather parameters, looping through the selected items in VBA, and modifying the report's RecordSource query before calling the OutputTo method.
Why does my command button do nothing in Design View?
Command buttons and their associated event macros are intentionally deactivated in Design View so developers can safely move and edit them. You must switch to Form View or Report View to test button functionality.




