This Access tutorial explain how to run Access Macro using RunCode.
You may also want to read:
Run Access Macro
Assume that you have already written a Sub Procedure helloWorld(). To run the Macro, you can press ALT+F11 and run the Procedure by pressing F5.
Alternatively, go back to the Access Windows, double click on the Module on the left hand side and run the Procedure by pressing F5.
If you are writing a Macro for users, they probably have no idea how to run it. Instead, we should create a button for them to double click to run the Macro.
Run Access Macro using RunCode
Press ALT+F11 to go back to VBE
Create a Function that calls the Macro helloWorld. We will explain why we need to do this step.
Go back to Access Windows, click on CREATE tab > Macro
Select Action RunCode, and then type the Function we want to call runHello(). You must include the brackets in the suffix.
Note that RunCode can only run Function, but not run Sub Procedure. On the other hand, there is no action to run Sub Procedure directly, thats why we have to create a Function and call the Sub Procedure.
Now you can double click on the Macro on the left hand side to run.