O'Reilly logo

Access 2003 VBA Programmer's Reference by Armen Stein, Graham Seach, Teresa Hennig, Patricia Cardoza

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1.6. Building Automation into Your Project

Access can help you build a quick macro in response to a control's event. There are two ways you can build an event:

  • Click the Build button on the toolbar (it looks like a magic wand).

  • Click to select the control and choose its properties. Click the Event tab of the Properties dialog box. When you click the event you want, an Ellipses icon will appear next to the event. Click the icon to launch the builder, as shown in Figure 1-15.

Figure 1.14. Figure 1-14

You can choose the Expression Builder, the Macro Builder, or the Code Builder. Choosing the Expression Builder displays Figure 1-16.

1.6.1. Using Expression Builder

The Expression Builder does just that—allows you to build an expression with the various fields and controls in your database. For example, in response to the click event of a command button, you can populate a text box on your form with the name of a particular product from the Products table. To build your expression, double-click the Tables branch of the tree in the bottom-left pane of the Expression Builder. Choose the Products table and all of the fields from that table appear in the middle pane of the Expression Builder. Double-click the Product Name field. You can perform a conditional and comparison operations within the Expression Builder as well. For example, you could enter the following in the Expression Builder: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required