8.4. Filtering and Sorting a Report
Reports offer much the same filtering and sorting features that you learned to use with the datasheet in Chapter 3.
8.4.1. Filtering a Report
The ProductCatalog report presents all the records from the Products table. However, reports often need to filter out just an important subset of information. For example, you may want to analyze the sales of products in a specific category or the orders made by customers in a specific city. In the case of the ProductCatalog, it's logical to leave out discontinued items. After all, there's no reason for Boutique Fudge to advertise items it no longer sells.
You can pare down the results that are included in a report in two ways. You've already learned about one option: creating a query that extracts the results you want, and then using that query to build your report. This option is a good choice if you already have a query that fits the bill or you plan to use this subset of data for several purposes (reports, editing, other queries, and so on).
Another choice is to apply the filtering through report settings . The advantage of this technique is that you can change the filter settings quickly and repeatedly. If you plan to use the same report to print several different subsets of data, this approach is best. For example, you could filter out the products in one category, print them, and then adjust the filtering to select products in a different category, which you could also print.
Report filtering works the same way datasheet filtering does (discussed in detail in Section 3.2.2). You have two options:
You can apply filters to multiple columns at once. To remove a filter, right-click the column, and then choose Clear Filter.
8.4.2. Sorting a Report
Ordinarily, a report has the same order as the underlying data source. If you've built your report on a query, the order is determined by the sort order you used in the query. If you've built your report on a table, the records have no particular order at all, although they'll typically appear in the order you added them.
Either way, you can apply formatting directly in your report, in much the same way that you can with the datasheet (Section 3.2.1). Simply right-click the appropriate column header, and then look for the sorting options. The sort commands depend on the data typefor example, you can order text fields alphabetically , dates chronologically, and numeric fields in ascending or descending order.
Note: You can sort using only one field at a time. If you want to apply a more complex sort that uses more than one column (for example, a sort that separates products into alphabetical categories and then orders each category by price), you need to build a query for your report.