Share this Page URL

Chapter 10. Presenting Data with Reports > Using a Parameter in Report Criteria - Pg. 355

Presenting Data with Reports 15. 355 16. Close the Properties dialog box, and then click the View button to open the report in the Pre- view window. You'll see expense reports only for campaigns for which more than 15 percent of the budget has been spent. Before saving and closing the CampaignExpenses report, switch the report to Design view, and then set the report's Filter On property to No. You might want to use the same filter criteria for a report each time you view the report. In our example, you might choose to review expense data only after a certain percentage of the budget is spent and might not need to see expense data otherwise. Using the ApplyFilter macro action or setting a report's filter properties in Visual Basic would let you see the entire report or the filtered report with more flexibility. For information about using macro actions, see Chapter 4, "Importing and Linking to Data." For information about applying a filter in Visual Basic, see the sidebar " Quick 'On Your Own'" in Chapter 7, "Designing Basic Forms," and the section "Using a Control's Value in Query and Filter Criteria" in Chapter 8, "Adding Features and Function to Forms." Using a Parameter in Report Criteria In Chapter 6, you saw how to build a parameter query so that you can provide selection criteria to a query when it's run rather than hard-code the criteria into the query's design. In Chapter 8, we used the values on a form as input for query parameters, which let you select a campaign or an expense category to view at run time. Parameters in a report offer the same flexibility. With a pa- rameter, you can customize a report so that it displays only a selection of data from its record source. In the next set of steps, we'll define a parameter for the ProductsByCountry report that will let us select data for a specific country. Define a parameter for a report