how to do everything with microsoft office access 2003 phần 6 doc

56 284 0
how to do everything with microsoft office access 2003 phần 6 doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

11 CHAPTER 11: Create and Customize Reports and Subreports 257 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 can also create multiple column reports to be used for printing mailing labels of all kinds and use Access tables for mail merge applications. As with most Access activities, there are several ways to start a new report design; you can begin from anywhere in the Database window. Use one of the following methods to open the New Report dialog box: ■ Click New on the Reports page of the Database window. ■ Choose Insert | Report from any object page. ■ Click the New Object button and choose Report from the list. ■ Click Tables or Queries under Objects and select a table or query name, then choose Insert | Report or click the New Object button and choose Report from the list. The New Report dialog box offers six ways to create a report, including three wizards and two AutoReport layouts. If you have selected or opened a table or query before starting the new report, that name also appears in the dialog box. The next step is to choose the method you want to use from the New Report dialog box list and select a table or query as the basis for the report, if desired. You must select a table or query if you want to choose one of the AutoReports. If you choose one of the wizards without first selecting a table or query as the basis, you can select one from the first wizard dialog box. If you choose Design View without naming a table or query, you will not have access to any field names unless you enter a table or query name in the Record Source property; but you can add other non-data-related controls to the design. Click OK after making the selections in the New Report dialog box to move on to the report building process. Use the Report Wizard The Report Wizard behaves much like the Form Wizard. It presents you with a series of dialog boxes that guide you through the design process. Most of the dialog boxes present the same kinds of options but the Report Wizard includes a couple of new ones that let you choose the sorting, grouping, and summarizing features. P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:14 AM Color profile: Generic CMYK printer profile Composite Default screen 258 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 In our first example, use the Report Wizard to create a report based on the Alpha Entry by Code Query, which limits the data in the Alpha Entry table of the Police database to only those with a numeric incident code. This screens out the employment fingerprint and traffic collision reports that do not involve a crime. To create this new report with the help of the Report Wizard: 1. Open the New Report dialog box and choose Report Wizard. You also can simply double-click the “Create report by using wizard” option on the Reports page of the Database window. 2. Click the down arrow in the Tables/Queries box, choose the Alpha Entry by Code Query as the basis for the report, and then click OK. 3. In the first dialog box, choose the fields you want to include in the report from the tables and queries in the database. Select all the fields in the Alpha Entry by Code Query and click Next. 4. In the second dialog box, the wizard asks if you want to group the records by any of the field values. Select Code as the name of the field by which you want to group and click the right arrow (>), as shown in Figure 11-1. ■ If you change your mind, select the field name and click the left arrow (<) to remove the group designation. The up and down arrows near Priority change the grouping order level. ■ If you are grouping on a field with numeric values, you can group by an interval such as 50 or 100. Click Grouping Options and choose from the drop-down list in the Grouping Intervals dialog box. P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:14 AM Color profile: Generic CMYK printer profile Composite Default screen 11 ■ If one of the fields you are grouping on is a number or currency field, the Summary Options button becomes available in the next dialog box. You’ll learn more about adding summaries in a later section. 5. Click Next to move to the next dialog box, which like the grouping level dialog box is unique to the Report Wizard. This dialog box asks if you want to sort your records within the groups in other than primary key order. The groups are automatically sorted in ascending order by the group field value. Figure 11-2 shows a sort specified by date in ascending order. You can sort on up to four fields by clicking the arrow next to the sort box and choosing the field from the list. If you want the sort in descending order, click the Ascending button to the right of the sort box. When you are done, click Next. 6. In the next dialog box (see Figure 11-3), you select the layout you want for the report and the print orientation. Choose a format and look at the sample in the left pane. For this example, select Align Left 1 and click Next. If you have selected a lot of fields, you might want to change the print orientation to landscape. CHAPTER 11: Create and Customize Reports and Subreports 259 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 FIGURE 11-1 Choosing Code as the grouping level Change grouping level Clear grouping fieldAdd grouping field Set grouping intervals P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:15 AM Color profile: Generic CMYK printer profile Composite Default screen 260 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 FIGURE 11-2 Specifying the record sort order FIGURE 11-3 Choosing the report layout and orientation P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:15 AM Color profile: Generic CMYK printer profile Composite Default screen 11 7. The next wizard dialog box offers six different styles from which to choose. 8. In the final dialog box, enter Alpha Entry by Code Report as the report name and click Finish. Figure 11-4 shows a Print Preview of the Alpha Entry by Code Report generated by the Report Wizard. CHAPTER 11: Create and Customize Reports and Subreports 261 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 FIGURE 11-4 The Alpha Entry by Code Report in Print Preview One Page Mulitple Pages Office Links ZoomTwo Pages First Page Zoom Previous Page Page Number Next Page Last Page P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:15 AM Color profile: Generic CMYK printer profile Composite Default screen If you also want to see an interpretation of the code with the code number in the group header, add the Description field from the Penal Codes table to the query. If some of the fields seem incomplete, you can switch to Report Design view and resize them to fit the contents. Preview and Print the Report When the Report Wizard has finished creating the report design, you can go directly to the report Design view to make changes or preview the report as it will be printed. If you have not used the Report Wizard or you just want to preview an existing report, select the desired report name in the Reports page of the Database window, then do one of the following: ■ Click the Preview button in the Database window, choose File | Print Preview, or simply press ALT-P. ■ Click the Print Preview toolbar button. ■ Right-click the report name in the Reports page and choose Print Preview from the shortcut menu. Work in the Print Preview Window The Access Print Preview window (refer to Figure 11-4) offers all kinds of ways to view the report including moving around within and among pages, looking at several pages at once, and changing the magnification so you can see the details more clearly. The horizontal and vertical scroll bars enable you to move about on the current page. The navigation buttons at the bottom of the Print Preview window let you move among pages in the report. Click one of the buttons to move to the first, previous, next, or last page of the report. You can also enter the page number in the page number box and press ENTER to move to a specific page. To close the Print Preview window, do one of the following: ■ Click the Close toolbar button ■ Press C or ESC ■ Choose File | Close If you open a report in Design view and then switch to Print Preview, clicking the Close toolbar button or pressing CTRL-C or ESC returns to Design view. However, choosing File | Close or clicking the Close button in the upper-right corner of the Print Preview window closes the Design view window too. When the Preview window closes, you return to the Database window or the report Design view, depending on where you were when you opened the Print Preview. 262 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:16 AM Color profile: Generic CMYK printer profile Composite Default screen 11 View Multiple Pages Previewing several pages at once can help you find pages that have too much white space or another format error. Using the Print Preview toolbar buttons, you can view one or two pages adjusted to fit the screen or up to 20 pages arranged in four rows of five pages each. To view one complete page at a time, do one of the following: ■ Click the One Page toolbar button. ■ Right-click and choose One Page from the shortcut menu. ■ Choose View | Pages and choose One Page from the list. To view two or more complete pages adjusted to fit the screen, choose Fit in the Zoom box and use one of the following methods: ■ Click the Two Pages toolbar button. ■ Click the Multiple Pages toolbar button and drag the mouse pointer over the grid to select the number of pages and the arrangement you want. ■ Choose View | Pages and choose the number of pages from the list. You have a choice of 1, 2, 4, 8, or 12 pages. ■ Right-click and choose Multiple Pages from the shortcut menu, then drag the mouse pointer over the grid to select the number of pages and the arrangement you want to see. To return to previewing a single page, click the One Page toolbar button. Change the Magnification When you first open the Print Preview window, the report is automatically displayed to fit a single page vertically on the screen. You can increase or decrease this degree of magnification to CHAPTER 11: Create and Customize Reports and Subreports 263 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:16 AM Color profile: Generic CMYK printer profile Composite Default screen 264 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 almost any value or ask Access to adjust the report to fit on the screen. Click the Zoom toolbar button to toggle between Fit and the most recent magnification you set. To change the magnification, click the arrow next to the Zoom combo box on the toolbar and choose a percentage between 10 percent and 1000 percent from the list, or enter a value and press ENTER. Additionally, you can right-click anywhere in the report preview and click Zoom in the shortcut menu, where you have the same choices as with the toolbar Zoom button. When the mouse pointer passes over the report preview, it changes to a magnifying glass you can click to zoom in and out in the report. This alternates the preview between Fit and the last percentage you have chosen. When the glass shows a minus sign (–), clicking zooms out, making the preview less magnified; clicking the magnifying glass with a plus sign (+) zooms in on the area where the pointer was when you clicked it. Use the Layout Preview Layout Preview is another way to preview a report. The window looks like the Print Preview window but shows just enough data to demonstrate every section of the report. This can help you verify that your new design is doing what you want. Layout Preview is available only from the report Design view. To see the Alpha Card with Entries report in Layout Preview: 1. Click View and choose Design View, or choose View | Design View. If you opened the Print Preview window from the Design view, click Close to return to the Design view. 2. Click View and choose Layout Preview, or choose View | Layout Preview. The report is reduced from 15 pages in Print Preview to two pages. 3. To return to Print Preview, close the Layout Preview and switch from Design view to Print Preview. Print the Report You can print the report from the preview window, from the Design view, or from the Database window without opening the report. Printing from the Layout Preview does not print the complete report, only the layout pages. Clicking the Print toolbar button or selecting Print from the shortcut menu sends the report directly to the printer without opening the Print dialog box. Choosing File | Print opens the Print dialog box, where you can select other print options. If you want to change any of the page options such as the margins, the page layout, the printer selection, the number of columns on the page, or the page size, you must run Page Setup. After setting the page specifications, you can choose the print options such as number of copies and the range of pages to print. Run Page Setup You can open the Page Setup dialog box from any view of a report or from the Database window without opening the report by choosing File | Page Setup. If you are in the Database window, select the report name before choosing Page Setup. If you are previewing the report in either the Layout or Print Preview, you can also click the Setup toolbar button or right-click in the report and choose Page Setup from the shortcut menu. P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:17 AM Color profile: Generic CMYK printer profile Composite Default screen 11 CHAPTER 11: Create and Customize Reports and Subreports 265 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 The page settings are stored with the report; they must be set only once to be in effect every time you print the report. The Page Setup dialog box has three tabs: Margins, Page, and Columns. ■ Click the Margins tab to set the width of each of the four page margins and choose whether to print only the data, without any of the labels or other unbound objects. ■ Click the Page tab to set the orientation of the print on the page (portrait or landscape), select the paper size and source, and select a different printer if you have more than one in your system. The choice of paper sources depends on the printer you are using. P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:17 AM Color profile: Generic CMYK printer profile Composite Default screen If you want to print using a printer other than the default printer, click Use Specific Printer, then click the Printer button. This opens a dialog box that displays a list of the printers currently installed in the system. Select a different printer and click OK to return to the Page Setup dialog box. After you have made all the desired changes to the page setup, click OK to return to the previous view of the report or the Database window. The column options are explained in the section “Design a Multiple-Column Report” later in this chapter. Modify the Report Design Working in the report Design view is almost identical to working in the form Design view; the controls are the same, although you include fewer types of controls in reports. You use the same toolbox, select the controls the same way, and set the control properties with the same property sheets. The method you use to open a report in Design view depends on where you start: ■ From the Database window, select the report name and click Design, or right-click the report name and choose Design View from the shortcut menu. ■ From the Print Preview or Layout Preview window, click Close if you previewed the report from Design view, or click the View button and choose Design View if you previewed from the Database window. Examine the Report Sections The wizard automatically adds page header and footer sections when it creates a report. The Page Header section contains information that is to be printed at the top of each page, such as the field names used as column headings. The Page Footer section contains information to be printed at the bottom of each page, such as the current date and the page number. To toggle the header and footer sections in and out of the design, choose View | Page Header/Footer. The Report Header and Footer sections contain information to be printed only once at the beginning or the end of the report. The Detail section contains the bulk of the data in the report. Add report headers and footers the same as page sections: choose View | Report Header/Footer. Choose again to delete both the sections. If there are any controls in one of the sections you try to delete, Access displays a message asking if you want to delete all the controls in the sections. Click Yes to delete them or No to abandon the deletion. The group header and footer sections, which are optional, contain information to be printed at the top and bottom of each group of records. These sections are used when you group the records by the values in a specific field, such as by Code in the Alpha Entry by Code Report shown earlier. You select a section in a report design the same way as in a form design by using one of the following methods: ■ Click the Object toolbar button and choose the desired section from the list. ■ Click the section selector at the left of the section label line. 266 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 P:\010Comp\HowTo8\938-1\ch11.vp Friday, August 08, 2003 10:29:17 AM Color profile: Generic CMYK printer profile Composite Default screen [...]... whether the section is to be printed on a separate page rather than the current page To print a complete section all on one page, set the Keep Together 11 268 How to Do Everything with Microsoft Office Access 2003 property to Yes To allow a section to expand or shrink to fit the data, set Can Grow and Can Shrink to Yes The group header section has one more property that is unique to that section: Repeat... year control 274 How to Do Everything with Microsoft Office Access 2003 4 Switch to Print Preview to see the year value in the group header Add Summaries and Running Totals In Chapter 9, you saw how to add calculated controls to form designs using expressions You can also use calculated controls to summarize data in a report Earlier you saw how the Report Wizard offered to add summaries to a report that... manufacturer” drop-down list Choose the desired label size from the Product Number list The dimensions are specified as height times width ■ If you want to create a custom label size, click the Customize button ■ If you have already created some custom label sizes, you can choose “Show custom label sizes” to see that list 11 292 How to Do Everything with Microsoft Office Access 2003 3 Click Next to open the... links in the Relationships window before trying to insert the subreport When you use the wizard to create a subreport or drag an existing report or datasheet from the Database window, Access automatically links the main report and subreport if one of the following conditions is met: ■ The reports are based on related tables 288 How to Do Everything with Microsoft Office Access 2003 ■ The main report has... the desired size before releasing the mouse button and starting the wizard 6 Choose “Use existing Tables and Queries” to create the new subreport, then click Next 7 In the next dialog box, select Alpha Entry from the Tables/Queries drop-down list, then click >> to select all the fields and click Next 2 86 How to Do Everything with Microsoft Office Access 2003 8 Accept the link the wizard suggests, which... the Report Wizard, let’s add the Alpha Entry information to the Alpha Card report, relating the two reports by the Index field 284 How to Do Everything with Microsoft Office Access 2003 FIGURE 11-10 Printed Alpha Card with Entries report CHAPTER 11: Create and Customize Reports and Subreports 285 Just to be safe, save the Alpha Card report with a different name before adding the subreport as follows:... again and drag the row to the desired position in the list of groupings If the groups you move have headers or footers, Access moves them and all the controls they contain to the new positions in the report design The controls might need some adjustment after repositioning 11 2 76 How to Do Everything with Microsoft Office Access 2003 Number Items in a Report Sometimes it is handy to have the items in... well To number the records in each group separately, add the calculated control to the detail section as above but set the Running Sum property to Over Group instead of Over All FIGURE 11-5 The Entries by Year report design CHAPTER 11: Create and Customize Reports and Subreports 277 11 FIGURE 11 -6 Printed first page of the Entries by Year report 278 How to Do Everything with Microsoft Office Access 2003. .. replace the Supervisor ID field with the LastName field to make the report more understandable to outsiders 280 How to Do Everything with Microsoft Office Access 2003 Print an Alphabetic Index By combining the Group On and Group Interval settings, you can create an alphabetic list of items grouped by the leading character For example, to create a list such as that shown in Figure 11-8: 1 Select the... not related to a potentially criminal offense The Alpha Entry by Code query contains the expression 0 in the Criteria row of the Code column in the grid After dragging the field names from the list to the detail section of the new Entries by Year report, you can proceed to group the records by the year the incident was reported 11 272 How to Do Everything with Microsoft Office Access 2003 To add a group . Preview. 262 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 11 P:10CompHowTo8938-1ch11.vp Friday,. section selector at the left of the section label line. 266 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen. Wizard but want to add a page number to your report: 268 How to Do Everything with Microsoft Office Access 2003 HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen

Ngày đăng: 14/08/2014, 08:22

Từ khóa liên quan

Mục lục

  • PART II Retrieve and Present Information

    • CHAPTER 11 Create and Customize Reports and Subreports

      • Start a New Report

        • Use the Report Wizard

        • Preview and Print the Report

          • Work in the Print Preview Window

          • Use the Layout Preview

          • Print the Report

          • Modify the Report Design

            • Examine the Report Sections

            • Set Report and Section Properties

            • Change the Report Style

            • Add Page Numbers and Date/Time Controls

            • Save the Report Design

            • Sort and Group Records in a Report

              • Change the Sort Order

              • Add Group Sections

              • Customize Group Headers and Footers

              • Add Summaries and Running Totals

              • Apply the Finishing Touches

              • Modify and Add Groups

              • Create a Summary Report with the Report Wizard

              • Print an Alphabetic Index

              • Add a Subreport

                • Create a Subreport with the Report Wizard

                • Create a Subreport Control

                • Insert an Existing Subreport

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan