Chart in report - urgent

L

Lynne

I am trying to print salary and benefit statements for my
company's employees. I want to include a simple pie chart
on each employees statement showing salary and benefits
as percentages of total compensation. The idea is to show
them how much the company actually spends on them in
addition to straight pay. Anyway, I must be having brain-
lock because the chart wizard is a complete mystery to
me. Can someone please tell me how to put a pie chart on
a report that will change with each employee?

Thanks,
Lynne
 
G

Guest

Lynne,

Some instructions for a using MsGraph with Access.

The Chart Wizard in Access leaves much to be desired,
ie: you're not limited to 6 Series.

Take a blank Form (even if you're making a graph for a Report)
and insert an unbound object frame.
With the form in design mode, Insert/Object (on the menus), select Ms Graph
(*Not* the Chart Wizard)

Click on the detail of your Form (ie: click off the graph)

Open the properties of the Graph object:
Format Tab: Size Mode - Zoom
Column Heads - Yes
Data Tab: Row Source Type - Table/Query
Row Source - Enter the name of your table, CrossTab Query, Select Query or
SQL (see info below)
Enabled - Yes
Locked - No

View the form then go right back to design view (this will load
the graph datasheet with your data vs the sample data).
Don't worry about what the graph looks like just yet.

Then right click the Graph and select Chart Object ->Open (not Edit)

Make sure the Data/Series is in Rows or Columns - whatever is
appropriate for your data.

Now you have something to work with. Select the graph type
and any formatting you wish.

The Row Source can be a table or query name or a sql statement which
makes it very nice for dynamic data.

Using automation you can dynamically change the graph
to suit your needs.

If you're *really* making a report, now copy the Graph object
from the form to the report.


Download the Graph Sample MDB from MsKb Q186855, Grphsm97.Exe
and convert it to a newer version of Access if req'd.

Study the Graph Help file Graph9.hlp (A97) or Graph9.chm (A2k)
Study the Graph object Methods and Properties in the Access Object Browser

Also get the automation help files appropriate for you
for various help in coding:

Q302460 Office XP Products
Q260410 Office 2000 Products
Q167223 Office 97 Products


In your case you want to create a recordset with the following info:

EmployeeID, Salary, Benefit
11, 200, 150
13, 250, 185
etc...

and use Master/Child linking between the graph and a text field on the
report for the current employee.

In addition, you will need to add the following code to the OnPrint section
of the report where you placed the graph to make sure Access keeps the data
in sync.


Dim oGraph As Object
Me.Graph1.Requery
Set oGraph = Me!Graph1
oGraph.Refresh
oGraph.Object.Application.Update
Set oGraph = Nothing


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top