Microsoft Access - Create a Macro

Microsoft Access provides the ability for you to create macros. A "macro" refers to a set of actions that can be run automatically, and on demand. You could make a macro run when a user presses a certain key, or you could make a macro run everytime your database is opened.

For example, if say 90% of your database usage is entering data into the same form, you could create a macro that automatically opens that form every time the database is opened. That way, it saves you from having to click on the Forms tab, then double clicking the form you want to open.

Here's how you can go about creating a macro:

  1. Ensuring the "Macros" tab is selected, click "New".
  2. Use the dropdown menu to select your first action - choose "OpenForm". In the bottom pane, select the form name you wish to open - choose "Individual Form"
    Create a macro - step 1
  3. Use the dropdown menu to select your second action - choose "GoToRecord". In the bottom pane, choose the record you want to go to - choose "New". What we're doing here is ensuring that the form doesn't open up a previous record - it goes straight to the end and has a blank record ready for you to enter a new record (this saves time and unnecessary clicks).
    Create a macro - step 2
  4. You're now ready to save your macro. To do this, click on the "Save" icon and enter a name for your macro. Make sure you name this macro "Autoexec". By naming it Autoexec, we are instructing Access to run this macro everytime we open the database.
    Create a macro - step 3

Testing your Macro

Now that you've created your macro, it's time to test it! Close your database and then open it again. You will notice that when you open it, the Individual Form automatically opens and is ready for you to enter a new record. You can also run macros by opening the Macros tab and double clicking on the macro you want to run (or selecting it and clicking "Run").

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!

Sponsored Link: Design CODE-FREE Websites

Check a Domain:

ZappyHost Logo
Webydo Banner Ad
Webydo Banner Ad