Thursday, January 6, 2022

Automate startup events with a macro

If you want to run certain actions each time you open an Access database or an Access web app, create an AutoExec macro in a desktop database, or an On Start macro in an Access web app. For example, in a desktop database, an AutoExec macro could automatically maximize the application window, lock the Navigation Pane, and open a particular report each time you open the database.

In this topic

Create an AutoExec macro in a desktop database

An AutoExec macro (a macro that you name AutoExec) runs before any other macros or modules in the database. If you've already created a macro that does what you want to happen when the database starts, just rename the macro AutoExec, and it will run the next time that you open the database. Otherwise, follow these steps to create a macro:

  1. Click Create > Macro.

    The Macro button on the Create tab.

  2. In the drop-down list at the top of the Macro Builder, select the action that you want to perform. If applicable, type the appropriate values in the argument boxes.

    • If you can't find the action you want, make sure Show All Actions is selected on the Design tab. This expands the list of actions that you can use, but the list will include some actions that will only run if the database is granted trusted status. For more information, see Decide whether to trust a database.

  3. Repeat step 2 for each additional action you want to occur. You can also search for actions in the Action Catalog and double-click or drag them into the macro.

  4. Click Save, and in the Save As dialog box, type AutoExec.

  5. Click OK and close the Macro Builder. The macro will run the next time you open the database.

For more information about how to create macros, see the article Create a user interface (UI) macro.

Notes: 

Top of Page

Create an On Start macro in an Access web app

An On Start macro in Access web apps performs the same sort of function as an AutoExec macro in a desktop database, but it does not appear in the Navigation Pane as a named macro. Also, instead of running when you open the database in the Access client, it runs when you open the web app in the browser. You can't bypass macro logic defined in an On Start macro when opening your web app in the browser.

Here's how to create one:

  1. Open the web app in Access. If you are viewing it in a browser, click Settings > Customize in Access.

  2. Click Home > Advanced > On Start Macro.

    The On Start Macro command on the ribbon.

    Access opens the macro designer. If an On Start macro already exists, Access displays it. If not, you'll see a blank macro where you can begin adding actions.

  3. Select actions from the Add New Action drop-down, or find actions in the Action Catalog and double-click or drag them into the macro.

    Tip: The Action Catalog displays short descriptions of the actions to help you learn what they do.

  4. If needed, enter values in the argument boxes for the actions you've added.

  5. Click Save > Close.

  6. Click Home > Launch App, and the On Start macro runs when the web app opens in the browser.

For more information about creating a macro in an Access web app, see Customizing a view by creating a user interface macro.

1 comment:

  1. Hello guys, I just want to share my joyful experience about HACK VANISH CREDIT SPECIALIST. Before the coronavirus pandemic, I had criminal Judgments, few evictions, and late payment which negatively impacted my credit score down to 487 and left me in difficult financial situation, as a single mum of 3, I needed a loan to keep the family running after I lost my husband as a result of COVID-19, all hope were lost, until Mrs. Olivia referred me to HACK VANISH, a credit genius who was very helpful in fixing my credit 6 days after I reached out to him via Email: hackvanish (At) gmail (Dot) com and Phone: +1(747) 293-8514, throughout the process, I felt so involved because an open line of communication was maintained till I got my FICO score restored to 796, currently my loan application has been approved. If you need to hire a credible hacker, HACK VANISH is highly recommended.

    ReplyDelete