Filters in Reports

Whether or not a filter is applied in a report created from a table or query depends on how the object was created. Try this exercise:


In the Database window, open the tblCustomers table and briefly review the data.


In the State column, select any CA value.


Right-click and choose Filter by Selection.


Close the table and click Yes to save your layout changes.


With tblCustomers selected in the Database window, choose Insert, AutoReport.


Scroll through the report by using the Next Page navigation button. The report has data from both California and non-California companies.


Choose File, Save As; save the report as rptAllCustomers and close it.


Open the tblCustomers table.


Click Apply Filter.

Because you saved the filter upon exit, you can reapply it upon opening.


On the Table Datasheet toolbar, click the arrow on the New Object drop-down button and choose AutoReport (see Figure 7.3 if you can't find this button).


Scroll through the records. Only those from California are included.


Save the report as rptCaliforniaCustomers and close it.


Click Remove Filter and close the table.

The Filter On property on the Data tab of the Report property sheet determines whether the records in a report are filtered. In both reports, the Report Wizard copied the saved filter from the table; however, for rptAllCustomers (created in the Database window), it did not apply it (see Figure 7.9). You can edit the Filter On property to Yes or No to apply or remove a filter when you run the report. The filter itself is displayed in the Filter property. In this case, you won't have any problem reading it, but complex filters are more difficult to decipher.

Figure 7.9. In this figure, the two customer reports are tiled and shown in Design view. The rptAllCustomers report currently has the focus, and the report property sheet shows that Filter On is No. If you switch the focus to rptCaliforniaCustomers, Filter On is Yes.

I won't spend any more time on filters in reports. I think you'll find it better and easier to use queries, including parameter queries, to generate reports with criteria. These topics are dealt with in Chapters 8, "Queries," and 9, "Queries, Part II."

Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider © 2008-2017.
If you may any questions please contact us: