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:
- Ensuring the "Macros" tab is selected, click "New".
- 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"
- 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).
- 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.
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").