Add a chart to a form or report

When you use the Chart Wizard to create a chart, it uses data you specify to determine whether it should create a global chart that shows all fields, or a record-bound chart that shows only the data in the current record as you move from record to record. If the Chart Wizard creates a global chart, and you want a record-bound chart, you can link the chart to a specific record. To use the Chart Wizard, you must have Microsoft Graph.

 Note   In a Microsoft Access project (Microsoft Access project: An Access file that connects to a Microsoft SQL Server database and is used to create client/server applications. A project file doesn't contain any data or data-definition-based objects, such as tables and views.), you can't use the Chart Wizard, but you can add a chart by inserting the Microsoft Graph Chart object (Insert menu, Object command).

ShowAdd a new chart

  1. Open the form or report in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.).
  2. On the Insert menu, click Chart.

If you create a lot of charts, you may want to add the Chart Button image button to the toolbar.

ShowHow?

 Note   You can add the Chart button to a toolbar in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.) of a form or report only in a Microsoft Access database (Microsoft Access database: A collection of data and objects (such as tables, queries, or forms) that is related to a particular topic or purpose.), not a Microsoft Access project (Microsoft Access project: An Access file that connects to a Microsoft SQL Server database and is used to create client/server applications. A project file doesn't contain any data or data-definition-based objects, such as tables and views.).

  1. Switch to the appropriate view, and make sure the toolbar you want to put the Chart button on is displayed.
  2. Right-click anywhere on the toolbar, and then click Customize on the shortcut menu.
  3. Click the Commands tab.
  4. In the Categories box, click Toolbox.
  5. Drag the Chart Button image button from the Commands box to the toolbar on which you want it to appear.
  1. On the form or report, click where you want to place the chart.
  2. Follow the instructions in the Chart Wizard, which creates the chart based on available tables or other record sources (record source: The underlying source of data for a form, report, or data access page. In an Access database, it could be a table, query, or SQL statement. In an Access project, it could be a table, view, SQL statement, or stored procedure.) and the fields you select.

 Note   At least one of the fields must have a data type (data type: The characteristic of a field that determines what type of data it can hold. Data types include Boolean, Integer, Long, Currency, Single, Double, Date, String, and Variant (default).) that stores only numbers, such as Currency.

  1. Switch to Form view (Form view: A view that displays a form to show or accept data. Form view is the primary means of adding and modifying data in tables. You can also change the design of a form in this view.) or Print Preview (print preview: A view of a document as it will appear when you print it.) to see the chart with current data.

 Note   In a Microsoft Access project (Microsoft Access project: An Access file that connects to a Microsoft SQL Server database and is used to create client/server applications. A project file doesn't contain any data or data-definition-based objects, such as tables and views.), you can't use the Chart Wizard, but you can add a chart by inserting the Microsoft Graph Chart object (Insert menu, Object command).

ShowCreate a record-bound chart from a global chart by linking it to a specific record

  1. Open the form or report in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.).
  2. Make sure the chart is selected, and then click Properties Button image.
  3. In the LinkChildFields and LinkMasterFields property boxes, type the name of a field that appears in the RowSource property box and uniquely identifies each record, such as a primary key (primary key: One or more fields (columns) whose values uniquely identify each record in a table. A primary key cannot allow Null values and must always have a unique index. A primary key is used to relate a table to foreign keys in other tables.).

The values in these property boxes must match record for record the values in a field in the underlying table or other record source (record source: The underlying source of data for a form, report, or data access page. In an Access database, it could be a table, query, or SQL statement. In an Access project, it could be a table, view, SQL statement, or stored procedure.) for the form or report. For example, suppose the form's underlying table includes the ProductID field. You want to link your chart on this field, so you type ProductID in the LinkChildFields and LinkMasterFields property boxes.

  1. To see whether your chart displays only the data for the current record, display the form in Form view (Form view: A view that displays a form to show or accept data. Form view is the primary means of adding and modifying data in tables. You can also change the design of a form in this view.), or look at the report in Print Preview (print preview: A view of a document as it will appear when you print it.).

ShowAdd an existing chart

Use this procedure to add an existing chart that was created in another Microsoft Access database (Microsoft Access database: A collection of data and objects (such as tables, queries, or forms) that is related to a particular topic or purpose.) or another program. When you do this, you will not be able to change the chart by changing data in your database.

  1. Open the form or report in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.).
  2. Click Unbound Object Frame Button image in the toolbox (toolbox: A set of tools that is available in Design view for adding controls to a form or report.).
  3. On the form or report, click where you want to place the chart.
  4. In the Insert Object dialog box, click Create From File, and then specify a path to the file. If you don't know the path, click Browse.
  5. If you want to link rather than embed (embed: To insert a copy of an OLE object from another application. The source of the object, called the OLE server, can be any application that supports object linking and embedding. Changes to an embedded object are not reflected in the original object.) the chart, select the Link check box.
  6. Select the Display As Icon check box if you want the chart to appear as an icon.
 
 
Applies to:
Access 2003