Others

Run an Access Macro or VBA Procedure from a Control Panel Form

Amos GikundaAmos Gikunda Nov 20, 2026 869 views

Question details

The user wants to run an Access macro or VBA procedure from a control panel form.

Run an Access Macro or VBA Procedure from a Control Panel Form
Product
Microsoft Access
Device & OS
not provided
Scenario
A control panel or switchboard form should run an action when a user clicks a button.
Observed behavior
Procedures in VBA modules do not appear in the list of selectable Access macros because they are different object types.
Before you start

Identify whether the action is saved as an Access macro or as a VBA procedure in a standard module. Open the control panel form in Design View and confirm that you can edit the button's On Click property.

Solution 1Recommended

Assign a saved Access macro to the form button

Use this method when the action is already an Access macro or when you want to create one for the button.

1
Create or locate the macro

In the Navigation Pane, find the saved macro. If you need a new one, select Create > Macro, add the required actions, and save it with a descriptive name.

2
Open the button properties

Right-click the control panel form in the Navigation Pane and select Design View. Select the button, then open its Property Sheet and select the Event tab.

3
Assign the macro

In the button's On Click property, select the saved macro from the drop-down list or enter its name where supported. Save the form.

4
Test the button

Switch to Form View and click the button to verify that the macro runs.

Assign a saved Access macro to the form button
Running a macro from VBA: If the button already uses an event procedure, you can call the saved macro within it using DoCmd.RunMacro "MacroName", replacing MacroName with the saved macro's name.
Free Microsoft Office alternative

Use WPS Office for Everyday Documents and Spreadsheets

WPS Office is a free, lightweight alternative with a familiar interface for working with Office files and moving everyday document workflows. It does not run Access databases or replace Access form macros and VBA procedures.

Create and edit documents, spreadsheets, and presentations in one suite.Open and save common Microsoft Office formats, including DOCX, XLSX, and PPTX.Use a familiar interface to transition everyday Office file workflows.Keep Access-specific form and macro tasks in Microsoft Access.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't my VBA procedure appear in the macro list?

Access macros and VBA procedures are different object types. A procedure in a standard module must be called by name, such as from the form button's On Click event procedure.

How do I run an existing macro from button code?

In the button's On Click event procedure, use DoCmd.RunMacro "MacroName" and replace MacroName with the saved Access macro's name.

Where can I find a form button's On Click property?

Open the form in Design View, select the button, and open the Property Sheet. The On Click property is on the Event tab.

Why might a button action not run when I test it?

Check that the On Click property points to the correct macro or event procedure and that the macro or procedure name is correct. If Access shows a security warning, enable content only if you trust the database.