Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 30: Using Access Macros


1067


For this example, use frmReportMenuEnhanced (shown in Figure 30.13), which contains the
same fraView shown in Figure 30.9, but adds a combo box (cboReport), which contains a list
of reports to run. The Run Command button executes mcrReportMenuEnhanced, which
doesn’t use submacros to decide which report to open.

FIGURE 30.13

frmReportMenuEnhanced uses a combo box to select which report to open.


Table 30.5 shows the conditions, actions, and action arguments for mcrReportMenuEnhanced
(shown in Figure 30.14), which opens one of three reports.

TABLE 30.5

mcrReportMenuEnhanced


Condition Action Action Argument Action Argument Setting

SetTempVar Name ReportName
Expression [Forms]![frmReportMenuEnhance
d]![cboReport]
SetTempVar Name ReportView
Expression [Forms]![frmReportMenuEnhance
d]![fraView]
[TempVars]!
[ReportView]=1

OpenReport Report Name
View
Window Mode

=[TempVars]![ReportName]
Print
Normal
[TempVars]!
[ReportView]=2

OpenReport Report Name
View
Window Mode

=[TempVars]![ReportName]
Print Preview
Normal
RemoveTempVar Name ReportName
RemoveTempVar Name ReportView
Free download pdf