Working with charts

A

Arni

Dear group,

I have created a very fine chart one a report (using
MSGraph.Chart.8).
Now do I want to change the RowSource for the chart
before printing it but I can't
I have generated a RowSource string by selecting data on
a form and expected to use that string for the chart
RowSource when the user hits a cmdPrint button. I desided
to send the string to a public variant (pubReport) and
call the variant from the report (OLEUnbound0.RowSource =
pubReport)

When using the Open and Activate events on the report do
I get:
Error 2455 - You entered an expression that has an
invalid reference to the property RowSource.

Some later occurring events Will give:
Error 2191 - You can't set the Row Source property in
print preview or after printing has started.

The code is working fine on a form with a chart but
reports works slightly differently and I have run out of
ideas.

What can I do to change a chart on a report by using VBA?

Thanks, Arni
 
D

Duane Hookom

You can try change the SQL of a saved query. Base your row source on the
saved query. I use DAO to change the SQL of a query with this basic syntax:
CurrentDb.QueryDefs("qtotForGraph").SQL = "SELECT..."
 
A

Arni

Thank you, Duane.
Regards, Arni L.
-----Original Message-----
You can try change the SQL of a saved query. Base your row source on the
saved query. I use DAO to change the SQL of a query with this basic syntax:
CurrentDb.QueryDefs("qtotForGraph").SQL = "SELECT..."

--
Duane Hookom
MS Access MVP





.
 

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