Microsoft Knowledge Base Email Alertz

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 by making selections from the combo boxes.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 208335 - Last Review: June 24, 2004 - Revision: 2.0

ACC2000: How to Create a Graph Bound to Two Combo Boxes

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

This article applies only to a Microsoft Access database (.mdb).

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 by making selections from the combo boxes.

MORE INFORMATION

To create a chart that displays data selected by two combo boxes, follow these steps:

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. In the Database window, click Queries, and then click New to create a new query in Design view.
  3. In the Show Table dialog box, add the following tables, and then click Close.
    Orders
    Order Details
    Products
    Categories
  4. On the View menu, click Totals.
  5. Add the following fields to the query grid:
    Field: Freight
    Table: Orders
    Total: Sum

    Field: ProductName
    Table: Products
    Total: Group By

    Field: CategoryName
    Table: Categories
    Total: Group By

    Field: Year: CStr(Nz(Year([OrderDate])))
    Total: Group By
  6. Save the query as qryGraph and close it.
  7. In the Database window, click Forms, and then click New. In the New Form dialog box, click Chart Wizard, and then select qryGraph as the query which the object's data comes from. Click OK.
  8. Move the SumofFreight, ProductName, and CategoryName fields from the Available Fields box to the Fields for Chart box, and then click Next.
  9. In the next wizard dialog box, select the Column Chart type, and then click Next.
  10. In the next wizard dialog box, drag CategoryName to the Axis list (bottom of graph), and then drag ProductName to the Series list (right side of graph). Be sure that they replace the items that are already displayed in the Axis list and the Series list. Click Next.
  11. In the next wizard dialog box, type Freight Dollars by Category as the title of your chart, and then click Finish. The form opens in Form view.
  12. On the View menu, click Design View.
  13. On the View menu, click Form Header/Footer.
  14. Add two combo box controls to the Form Header section, and then assign the following properties to each combo box:
    Combo Box 1
    Name: SelectCat
    Row Source Type: Table/Query
    Row Source: Categories
    Column Count: 2
    Column Width: 0";1"
    Bound Column: 2

    Combo Box 2
    Name: SelectYear
    Row Source Type: Value List
    Row Source: 1996;1997;1998;1999
  15. Click the graph, and modify the following properties of the unbound object frame:
    Unbound Object Frame
    Name: FreightGraph
    Size Mode: Zoom
    Link Child Fields: CategoryName;Year
    Link Master Fields: SelectCat;SelectYear
    Width: 6.5"
    Height: 3.25"
  16. On the View menu, click Form View. Click different categories and years in each of the two combo boxes on the form.

    Note that the contents of the graph change. If you select 1999 as the year, the graph is blank because there is no data for that year.

REFERENCES

For more information about graph control properties, click Microsoft Access Help on the Help menu, type chart control properties (forms and reports) in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

For more information about combo box properties, click Microsoft Access Help on the Help menu, type combo boxes: what they are and how they work in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbhowto kbusage KB208335
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate