Change the data of a graph programmatically

G

Guest

Hi,

I want to have a chart in a report whose rowsource property should be able
to be changed programmatically. User will select an item from a combo box and
based upon that value, various queries should be selected as the rowsource.

The problem I am facting is that I am unable to make reference to the graph
in the code window of the report. I used the following bit of code to refer
to the chart (I chose MS graph Chart) which was placed on the report using an
unbound object frame.

Reports!ReportName.Graphname.

BUt after GraphName and period, I am not getting INtellisense menu and
rowsource property. Somebody can help?

2) If I can get the rowsource property there, then I should be able to
change the data programmatically, right?


3) What is the difference between MS Excel chart and MS Graph Chart? Which
one should be used in the report ?
 
D

Duane Hookom

From my understanding there isn't much difference between the two chart
controls.

I never attempt to change a property on a report from code that isn't in the
report. I would use a saved query as the Row Source of the chart. You can
then use code prior to opening the report to set the SQL property of the
chart's row source query.

Currentdb.QueryDefs("qtotChartQuery").SQL = "SELECT....FROM...."
 
G

Guest

Hi,

Thanks for the reply.

The query I am using for the chart is a union query and in the WHERE clause,
parameters are to be passed. The values for these parameters are from a form
which is opened in acDialog windowmode when the open event of the report
occurs. IN this case, how do I save the query before opening the report.

I am a novice in Access and programming and learning by myself. Hope you or
somebody else will take the trouble to reply

Thanks
Best Regards,

Naj


Duane Hookom said:
From my understanding there isn't much difference between the two chart
controls.

I never attempt to change a property on a report from code that isn't in the
report. I would use a saved query as the Row Source of the chart. You can
then use code prior to opening the report to set the SQL property of the
chart's row source query.

Currentdb.QueryDefs("qtotChartQuery").SQL = "SELECT....FROM...."
 
D

Duane Hookom

I should have first asked why you need to change the row source of the graph
control. Your row source query can contain a criteria based on values in
controls on forms.

Have you tried using code behind the dialog form to change the SQL property
of a saved query?
--
Duane Hookom
MS Access MVP


Naj said:
Hi,

Thanks for the reply.

The query I am using for the chart is a union query and in the WHERE
clause,
parameters are to be passed. The values for these parameters are from a
form
which is opened in acDialog windowmode when the open event of the report
occurs. IN this case, how do I save the query before opening the report.

I am a novice in Access and programming and learning by myself. Hope you
or
somebody else will take the trouble to reply

Thanks
Best Regards,

Naj
 

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