Printing Graphs or Charts in Reports

The process of adding an unbound MSGraph object to an Access report is identical to that for forms. Unless all your users have access to a color printer, you should select a line graph subtype that identifies data points with a different symbol for each category. For area and stacked column charts, a series of hatched patterns differentiate the product categories. The Custom Types page of the Chart Types dialog offers a selection of B&W... chart types specifically designed for monochrome printers.

You can save a form created by the Chart Wizard to a report by choosing File, Save As, and selecting Report in the Save As dialog. It's almost as easy to create a new report and copy the form's unbound object frame to it, which also demonstrates how to add a graph to an existing report. Follow these steps:

  1. graphics/design_view.gif Open the form with the graph or chart in Design view, select the unbound OLE object frame, and press Ctrl+C to copy the control to the Clipboard. For this example, copy frm1997SalesByCategoryChart's OLEUnbound0 object.

  2. graphics/report_shortcut.gif Click the New Object button, and choose Report to open the New Report dialog. Optionally, select the data source for the report, in this case qry1997SalesChart. Click OK to open the new report in Design view.

  3. Choose View, Report Header/Footer to add Header and Footer sections to the report. If you plan to add fields to the Detail section, you usually add the chart or graph to the report Footer section. Otherwise, choose View, Page Header/Footer to eliminate these sections, close up the Detail and Report Footer sections of the report, and select the Report Header section.

  4. Press Ctrl+V to paste the graph or chart to the selected section.

  5. Adjust the height and width of the unbound object frame within the printing limits of the page. Optionally, move the object frame down, and add a label with a report title. Alternatively, you can add a chart title.

  6. Double-click the object frame to activate the object, close the Datasheet window, and choose Chart, Chart Type to open the Chart Type dialog.

  7. Click the Custom Types tab, and choose B&W Area to change the style to an area chart with hatching (see Figure 18.20).

    Figure 18.20. The B&W Area style is a better selection for printing (in most cases) than B&W Column, which includes a data table.

    graphics/18fig20.jpg

  8. graphics/preview.gif Click OK to apply the style. Click the Report Header bar to deselect the graph and click Print Preview to display the chart, which has a gray background, regular (not-bold) text, and unformatted y-axis labels (see Figure 18.21). Click Close to return to Design view.

    Figure 18.21. Selecting a different chart style removes much of the formatting you applied to the copied chart.

    graphics/18fig21.jpg

  9. To remove the gray background, which consumes toner or ink but doesn't contribute to readability, double-click the object frame to activate it. Right-click the gray region, and choose Format Chart Area to open the dialog of the same name. On the Patterns page, select the None option in the Area frame to make the background transparent, and click OK.

  10. Double-click the y-axis labels to open the Format Axis dialog, click the Number tab, select Currency, set Decimal Places to 0, and click OK.

  11. graphics/properties_window.gif Click the Report Header bar to deactivate the object, and open the Properties window for the object frame (OLEUnbound0 for this example).

  12. Click the Format tab, and set the Border Style property value to Transparent.

    Note

    Selecting the None option in the Border frame of the Format Chart Area dialog's Patterns page doesn't remove the default border of the object frame.

  13. Select the Report, and set the Caption property value to 1997 Monthly Sales by Category.

  14. graphics/preview.gif Click the Print Preview button to display your modified report design (see Figure 18.22). You can't activate the chart object for editing in Print Preview mode.

    Figure 18.22. Monochrome reports use hatching and shading to differentiate areas by classification. Unfortunately, many laser printers don't distinguish dark regions, such as Confections and Beverages in this example.

    graphics/18fig22.jpg

  15. Save your report with a descriptive name, such as rpt1997SalesByCategoryChart for this example.

You can increase the printed width of the graph by returning to Design view and double-clicking the Legend to open the Format Legend dialog. Click the Placement tab, and select the Bottom option. Optionally, click the Format tab and select the None option in the Border frame. Figure 18.23 shows the report with the relocated legend.

Figure 18.23. Relocating the legend to the bottom of a report (or form) lets you increase the printed (or displayed) width of the chart.

graphics/18fig23.jpg



Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net