|[ LiB ]|
A report is the database object that lets you present data in a meaningful way for sharing or even just storing. In this last section in this chapter, you'll learn how to
Build reports based on tables and queries.
Rearrange a report.
Group and summarize report data.
Preview and print reports.
Reports are used to share data or even to just store hard copies of data.
Create and save a report based on a table, query.
Reports are based on a data source, either a table or a query. There are a number of ways to create a report:
Choose Report from the Insert menu.
Choose Report or AutoReport from the New Object button's drop-down list.
Click the Reports shortcut on the Object bar and double-click one of the shortcut items.
Click the Reports shortcut on the Objects bar and click New or Design on the Database Window toolbar.
If a report is based on data in more than one table, you must use a query that's based on the appropriate tables.
Change arrangement of data fields and headings within a report layout.
Figure 6.24 shows a report in design view, which is where you determine the report's layout. As you can see, there are a number of sections, but there can be more.
Using the drag and drop methods , move controls (and labels) to other sections or to new positions within the same section.
Group data under a specific heading (field) in a report in ascending , descending order.
When using a wizard to generate a report, you get the opportunity to specify whether the report is grouping data by specific fields. When creating a report from scratch, you can use the Sorting and Grouping feature.
With the report in design view, click the Sorting and Grouping tool. In the resulting dialog box, specify the fields you're grouping and specify a sort order if necessary, as shown in Figure 6.25. The grouped report reduces all matching values into one line and displays all the data within that group, as you can see in Figure 6.26.
Present specific fields in a grouped report by sum, minimum, maximum, average, count, at appropriate break points.
Often, a grouped report summarizes the data in each group, like the one shown in Figure 6.27. Specifically, the report shows three levels of counting the number of orders: the number of orders per customer, the number of orders per month for each customer, and the total number of orders. To summarize the data, you simply add the appropriate domain expression to the appropriate area. A domain expression is an expression that evaluates an expression using a set of records:
Any expression in the detail section returns a value for each record.
An expression in a group's header or footer evaluates each group.
An expression in the report's header or footer evaluates all the data in the report.
To create a grouped report, you can use the Report Wizard. To see this in action, follow these steps.
Add, modify text in headers, footers in a report.
Each report has two types of headers and footers. There's one at the report level: it is a good spot to put a report title, date, author, or report summary details. Another is at the page level, and it is a great place to display page numbers . (These are available to every report, unlike group headers and footers.) With the report in design view, choose Report Header/Footer or Page Header/Footer from the View menu to open the appropriate section of the report. Once the section is open, you simply insert controls as you normally would. For example, to add text to a header, drag a Label control to the header and then add the text to the Caption property of the label. To modify the text, edit the Caption property of the label.
Delete a report.
To delete a report, click the Reports shortcut on the Objects bar in the Database window. Then, select the report and press Delete. When prompted, either confirm or cancel the action.
Save and close a report.
You save and close a report as you have all the other objects. To save a report, choose Save from the File menu, enter a name , and click OK. Or close the report and save the report when prompted.
To close a report, choose Close from the File menu. Or click the Close button on the report's title bar.
|[ LiB ]|