VBA & Macro Problems

Fix an Access 365 Command Button That Won’t Open a Form

Maira MehtabMaira Mehtab Nov 14, 2026 869 views

Question details

Restore an Access command button that should open a report criteria form after migration to Access 365.

Fix an Access 365 Command Button That Won’t Open a Form
Product
Microsoft Access 365
Device & OS
not provided
Scenario
A command button uses the lstReports list box to pass a value to the frmRptCritB report criteria form.
Observed behavior
Clicking the command button produces no response after the database is migrated to Access 365.
Before you start

Open the database in Access and confirm that the form frmRptCritB and the list box lstReports still exist. Review the button’s existing On Click code before replacing it, so you can retain any other required actions.

Solution 1Recommended

Recreate the command button’s On Click event

Use this method when the button’s event procedure is missing, disconnected, or no longer runs after migration.

1
Open the button properties

Open the form containing the command button in Design View, select the button, and open the Property Sheet.

2
Create the event procedure

On the Event tab, set On Click to [Event Procedure]. Click the Build button (...) beside the property and choose Code Builder if prompted.

3
Add the form-opening code

In the button’s generated Click procedure, add this line between Private Sub and End Sub: DoCmd.OpenForm "frmRptCritB", OpenArgs:=Me.lstReports.Column(0)

4
Compile and test

In the VBA editor, choose Debug > Compile, resolve any reported errors, and save. Return to Form View, select a report in lstReports, and click the button.

Recreate the command button’s On Click event
Check the value passed to the form: Column(0) refers to the first column of lstReports. Select a list item before clicking the button, and confirm that frmRptCritB expects that value through OpenArgs.
Free Microsoft Office alternative

Use WPS Office for documents, spreadsheets, and presentations

WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility for easier migration of everyday files. It does not repair or run Access database forms and VBA events.

Work with report-related documents and spreadsheets in one office suiteOpen and edit Microsoft Office formats, including DOCX, XLSX, and PPTXGet started with a familiar, easy-to-use interfaceUse a free, lightweight suite for everyday office tasks
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Access command button do nothing when clicked?

The On Click property may not point to an event procedure, or Access may be blocking VBA in an untrusted database. Check the button’s Property Sheet > Event tab and any security warning shown when the database opens.

How do I pass the selected list box value to the form?

In the button’s Click procedure, use DoCmd.OpenForm "frmRptCritB", OpenArgs:=Me.lstReports.Column(0). Select an item first and ensure the destination form expects the first column’s value in OpenArgs.

Where can I check whether the VBA code compiles?

Press Alt+F11 in Access to open the VBA editor, then choose Debug > Compile. Resolve any errors reported before testing the button again.

Can WPS Office fix an Access command button?

No. The button, form, and VBA event must be repaired in Microsoft Access. WPS Office can be used separately for compatible documents, spreadsheets, and presentations.