Microsoft Access 2010 Bible

(Rick Simeone) #1

Part II: Programming Microsoft Access


556


The same view is obtained somewhat differently if the table is in Design view. If the table is in
Design view, select the Create Data Macros command from the Design ribbon tab, and select a
table event from the drop-down list that appears (see Figure 15.3).

FIGURE 15.3

Selecting a table event with a table in Design view.


In either case, the Macro Designer opens as shown in Figure 15.2. in Figure 15.2, the table’s
AfterUpdate event has been selected. When the Access tabbed interface is used, the table’s
name and selected event appears in the Macro Designer’s tab. If the overlapping windows interface
is selected, this information appears in the Access main window’s caption.

In Figure 15.1 and again in Figure 15.3, notice the Named Macro option. A named macro is just
like a data macro attached to a table event. The only difference is that a named macro is “free float-
ing” and not specifically tied to a particular event. A named macro is meant to be called from an
event macro and typically implements logic that is common to a table’s fields. Consider the busi-
ness rule described earlier. If more than one data macro in a table might change a product’s whole-
sale cost, you might create a named macro to handle updating the RetailPrice field. The
named macro could then be called by any of the table’s other data macros so that every macro
within the table handles the update in the same way.
Free download pdf