How To Create Macros In Access 2010

show more Creating macros provides you with in-depth training on Business. Taught by Alicia Katz Pollock as part of the Access 2010 Essential Training show less
please wait ...

Creating macros

Macros are series of actions that can be triggered by data entered, or buttons on forms. They're incredibly useful for automating your database. Macros are very complex, and an entire course could be written just on this topic. In this lesson, I'll introduce you to the Macro Designer, and we'll create one basic action. We'll create a Macro that will open an order form and move to the Customer field within it. To create a Macro, click on the Create button and then click on Macro, on the far right. The Macro Designer window opens. There's one Action field to get you started, and here's a button to toggle on and off the Action Catalog, which lists all the available macros.

If you click on Show All Actions, you'll see additional Macros here beyond the basic set. We want the command OpenForm. Instead of searching around to find it, I can click in Search right here and type Open, and it will bring up all the Macros that use open in the title. We want OpenForm. I can either drag it into my Macro or double-click on it. The Macro appears with all the parameters and arguments it needs to run. The form I want to open is the Orders Subform.

Use this dropdown to find it. The view that we want is form. We are not going to add in any filters or conditions. The Data mode allows you to choose whether it's going to open up in Add - which will start with the blank record, Edit - which will show you all the records so that you can change them, or Read Only - so you can view the data but not make any changes to it. We want Add, and then our Window mode will be Normal. Now, run the Macro and see what it does.

Come up here to the exclamation point. When it asks you to save, say Yes. And we're going to call it, in all lowercase letters, neworder, and then click OK. So now we have an open orderform, but it would be handy to have it skip down to the Customer field, since the Order field will Auto Fill, and the Date will usually be correct. So let's right-click and close this form and go back to our Macro, and in the dropdown under the first step, let's create a second step.

Click on it, scroll down and choose GoToControl. Remember from the Forms lesson that a control is a field on the form. Enter in a square bracket, and type "Customer," the field on the form. Save the Macro again. Go back to the Design Tab and run it. And it opens up the orderform and jump straight down to the Customer field. In the next lesson, we'll see how to activate that Macro in the database.

Macros are a complex but powerful way of forcing Access to do your bidding, allowing you to program desired actions for a variety of triggers.

Creating macros
Video duration: 2m 53s 3h 30m Beginner


Creating macros provides you with in-depth training on Business. Taught by Alicia Katz Pollock as part of the Access 2010 Essential Training

please wait ...