How to use PivotCharts to create linked charts in forms in Access 2002 (281811)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q281811
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SUMMARY

It is sometimes useful to create forms with linked charts in order to chart data that only applies to the current record of the form. In earlier versions of Microsoft Access, you could do this by using Microsoft Graph. This article demonstrates how you can create linked charts by using the new PivotChart view for forms instead of using Microsoft Graph.

MORE INFORMATION

You can create linked PivotCharts for forms by using subforms in PivotChart view. Similar to OLE object frames that contain a Microsoft Graph object, you can use the LinkMasterFields and LinkChildFields properties of a subform to link a subform in PivotChart view. To create a linked subform in Pivotchart view, follow these steps:
  1. Open the sample database Northwind.mdb.
  2. Create a new form that is based on the Sales by Category query.
  3. Add all fields to the form.
  4. Set the DefaultView property of the form to PivotChart.
  5. Save the form as frmSubPivotChart, and then close it.
  6. Open the frmSubPivotChart form in PivotChart view.
  7. If the Chart field list is not displayed, click Field List on the View menu.
  8. Drag the ProductName field from the Chart field list to the "Drop Category Fields Here" drop area.
  9. Drag the ProductSales field from the Chart field list to the "Drop Data Fields Here" drop area.
  10. On the View menu, click Drop Areas to hide the drop areas.
  11. On the PivotChart menu, click Chart Type.
  12. Select Bar from the chart types shown on the left.
  13. Select the Clustered Bar subtype shown on the right (the first chart subtype displayed).
  14. Click the General tab.
  15. In the Select box, click Category Axis 1 Title.
  16. Click the Format tab.
  17. Type Product Name in the caption box, and then close the Properties dialog box.
  18. Close the form.
  19. Create a new form that is based on the Categories table.
  20. Add the CategoryID, CategoryName, and Description fields to the form.
  21. Drag the frmSubPivotChart form from the Database window to the detail section of the form.
  22. View the properties of the subform and verify that the LinkMasterFields and LinkChildFields properties are both set to CategoryID.
  23. Open the form in Form view.
  24. Scroll through the records on the form.
Note that the PivotChart subform is automatically updated to chart only the products that apply to the current category on the mainform.

Modification Type:MinorLast Reviewed:8/11/2004
Keywords:kbView kbchart kbhowto KB281811