Knowledge Base |

# ACC: How to Create a Graph Bound to Two Combo Boxes (1.x/2.0)

Article ID: 109323

Article Last Modified on 5/6/2003

APPLIES TO

- Microsoft Access 1.0 Standard Edition
- Microsoft Access 1.1 Standard Edition
- Microsoft Access 2.0 Standard Edition

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

## SUMMARY

This article describes how to create a graph that is bound to two combo boxes. You can control the data that is displayed in the graph with your selections in the combo boxes.

## MORE INFORMATION

The following example demonstrates how to set up a graph that is bound to two combo boxes:

1. Start Microsoft Access and open the sample database NWIND.MDB.
2. Create the following query based on the Orders, Order Details, and Products tables:

              Query: QueryTest
              -----------------------------------------------------
              Field Name: Order Amount
                 Table Name: Orders
                 Total: Sum
              Field Name: Product Name
                 Table Name: Products
                 Total: Group By
              Field Name: Category ID
                 Table Name: Products
                 Total: Group By
              Field Name: Year: CStr(NulltoZero(Year([Order Date])))
                 Table Name:
                 Total: Group By

3. Create a new form based on the QueryTest query. Choose Form Wizards.
4. Select Graph, and then choose OK.
5. Choose Next.
6. Select SumofOrderAmount, and then choose ">". Select Product Name, and then choose ">". Select Category ID, and then choose ">". Choose Next.
7. Select Category ID, and then choose Next.
8. Choose Open to view the form in Form view.
9. View the form in Design view.
10. From the Layout menu, choose Form Hdr/Ftr.
11. Add two combo boxes with the following properties to the form:

               Object: Combo box
               -----------------------------
               ControlName: SelectCat
                  RowSourceType: Table/Query
                  RowSource: Categories

               Object: Combo box
               ---------------------------------
               ControlName: SelectYear
                  RowSourceType: Value List
                  RowSource: 1989;1990;1991;1992

12. Select the graph and modify the properties of its object frame as follows:

               Object: Object Frame
               -----------------------------------------
               ControlName: Embedded0
                  LinkChildFields: Category Id;Year
                  LinkMasterFields: SelectCat;SelectYear

13. View the form in Form view. Note that as you make different selections in the combo boxes, the contents of the graph change.

Keywords: kbhowto KB109323