Export an Embedded Form Event Macro in Access 2016
Question details
Transfer a button's embedded On Click macro from an Access 2016 form to another database.

- Product
- Microsoft Access 2016
- Device & OS
- not provided
- Scenario
- A form button uses a macro created in Macro Builder, and the user wants to reuse it in another database.
- Observed behavior
- The macro does not appear as a separate macro object or as VBA code in the Visual Basic Editor.
Identify the form and button that contain the On Click macro, and locate the destination Access database. Check which tables, queries, and other objects the form and macro use so you can reconnect them after the transfer.
Export the form containing the embedded macro
Use this method to transfer the button and its embedded event macro together to another Access database.
An embedded event macro is stored with its form, not as a standalone macro object or VBA procedure. Exporting the form carries the macro with it, but related tables and queries may need to be transferred or linked separately.
Open the source database in Access and find the form in the Navigation Pane.
Right-click the form, select Export > Access, and browse to the destination database.
Choose a name for the exported form and complete the export dialog.
Open the destination database, open the exported form in Design View, and check its Record Source in the Property Sheet. Add or link any required tables and queries, and check other objects referenced by the macro.
Open the exported form in Form View and click the button to confirm that its On Click macro runs as expected.

Use WPS Office for documents alongside your Access database
WPS Office is a free, lightweight, easy-to-use alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format support make it easy to move existing files, but it does not export Access macros or replace Access for editing ACCDB databases.

Frequently Asked Questions
Why can't I find the button macro in the Navigation Pane?
An embedded On Click macro is stored with the form rather than as a separate macro object. Open the form in Design View, select the button, and inspect its On Click property in the Property Sheet.
Why doesn't the macro appear in the Visual Basic Editor?
A macro created with Access Macro Builder is not automatically stored as VBA code. Open the button's On Click property to inspect the embedded macro in Macro Builder.
Will exporting the form also transfer its tables and queries?
Do not assume that exporting the form transfers its dependencies. In the destination database, check the form's Record Source and the objects referenced by its macro, then import or link what it needs.
How can I distribute future changes to multiple users?
Consider splitting the Access database into a back end containing tables and a front end containing forms and other interface objects. You can then distribute an updated front end when the form or its embedded macro changes.




