Chapter 7. Working with Reports

Working with Reports

Chapter 7 at a Glance

In this chapter you will learn how to:

  • Create a report by using a wizard.

  • Modify a report.

  • Create a report from scratch.

  • Add a subreport to a report.

  • Preview and print a report.

People generally think of reports as summaries of larger bodies of information. For example, The Garden Company’s database might hold detailed information about thousands of orders. If you want to edit those orders or enter new ones, you do so directly in the table or with a form. If you want to summarize those orders to illustrate the rate of growth of the company’s sales, you use a report.

Like a book report or the annual report of a company’s activities, a report created in Microsoft Office Access 2003 is typically used to summarize and organize information to express a particular point of view to a specific audience. When designing a report, it is important to consider the point you are trying to make, the intended audience, and the level of information they will need.

In many ways, reports are like forms. You can use similar wizards to create them, and the design environment is much the same. Just as with a form, you can add label, text box, image, and other controls, and you can set their properties. You can display information from one or more records from one or more tables or queries, and you can have multiple sets of headers and footers.

Working with Reports

In this chapter, you will use the GardenCo database to learn how to generate and print reports that extract specific information from a database and format it in an easy-to-read style.

See Also

Do you need only a quick refresher on the topics in this chapter? See the Quick Reference entries in Chapter 7 Working with Reports.

Important

Important

Before you can use the practice files in this chapter, you need to install them from the book’s companion CD to their default location. See "Using the Book’s CD-ROM" for more information.

Creating a Report by Using a Wizard

Creating a Report by Using a Wizard

The content of an Access report can be divided into two general categories: information derived from records in one or more tables, and everything else. The everything else category includes the title, page headers and footers, introductory and explanatory text, logo, background and graphics, and calculations based on database content.

You can use a wizard to get a jump-start on a report. The wizard creates a basic layout, attaches styles, and adds a text box control and its associated label for each field you specify. Depending on the report you want to produce, you might be able to do almost all the work in the wizard, or you might have to refine the report in Design view.

In this exercise, you will use the Report Wizard to create a simple report that displays an alphabetical list of The Garden Company’s products.

BE SURE TO start Access before beginning this exercise.

USE the GardenCo database in the practice file folder for this topic. This practice file is located in the My DocumentsMicrosoft PressAccess 2003 SBSReportsRepByWiz folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Access 2003 Step by Step.

OPEN the GardenCo database and acknowledge the safety warning, if necessary.

  1. On the Objects bar, click Tables, and then click the Products table to select it.

  2. On the Insert menu, click Report to display the New Report dialog box.

    Notice in the New Report dialog box that Products is already selected as the table on which to base the new report.

    Tip

    If you select a table or query before starting the Report Wizard, that table or query becomes the basis for the report.

  3. Double-click Report Wizard.

    The first page of the Report Wizard appears.

    Tip

    You can also start the Report Wizard by displaying the New Object button’s list and clicking Report, or by double-clicking "Create report by using wizard" in the Report pane of the database window.

  4. Double-click ProductName, QuantityPerUnit, and UnitsInStock to move them from the Available Fields list to the Selected Fields list.

    Tip

    Fields appear in a report in the same order as they are listed in the wizard’s Selected Fields list. You can save yourself the effort of rearranging the fields in the report if you enter them in the desired order in the wizard.

  5. Select Tables:Categories in the Tables/Queries list to display the fields from the Categories table.

  6. Click ProductName in the Selected Fields list to select it.

    The next field you add will be inserted below the selected field.

  7. Double-click CategoryName.

    Tip

    Tip

    If you are using more than two tables in a form or report, or if you will be using the same combination of tables in several places, you can save time by creating a query based on those tables, and using that query as the basis for the form or report.

  8. Click Next to display the wizard’s second page.

    Tip

    When you include more than one table in a report, the wizard evaluates the relationships between the tables, and offers to group the records in any logical manner available. In this example, you can group them by category or by product. You can click either option to see it depicted in the right pane.

    Important

    If the relationships between the tables aren’t already established in the Relationships window, you have to cancel the wizard and establish them.

  9. Accept the default to group by Products, and click Next.

    On this page, you can specify the fields to establish grouping levels.

  10. Double-click ProductName to move it to the top of the simulated report on the right.

  11. Click the Grouping Options button at the bottom of the page to display the Grouping Intervals dialog box.

    Important
  12. Click the down arrow to the right of the Grouping intervals box, click 1st Letter, and then click OK.

    Important
  13. Click Next to display a page on which you can specify the sort order and summary options.

  14. Click the down arrow in the first field, and click ProductName in the drop-down list as the first Ascending sort field.

    You can use this page to specify up to four fields by which to sort. If any fields include numeric information, the Summary Options button becomes available. You can click it to display a list of the numeric fields, each with Sum, Avg (average), Min (minimum), and Max (maximum) check boxes. The only numeric field in this report is UnitsInStock, and there is no need to summarize it.

  15. Click Next to display the next page of the wizard.

    A page displaying the options in the Layout group appears. None of them is exactly what you are looking for, but Outline 1 is close.

  16. Click Outline 1, leave the Portrait orientation option selected, leave the Adjust the field width so all fields fit on a page option selected, and then click Next to display a list of predefined styles.

  17. Click Compact, and then click Next to display the wizard’s final page.

  18. Type Alphabetical List of Products as the title, and click Finish to preview the report.

    Important
  19. Close the report window.

CLOSE the GardenCo database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset