Setting the rowsource of a chart

SunWuKung

Registered User.
Local time
Today, 06:54
Joined
Jun 21, 2001
Messages
172
I am creating a report in an Access Project. The report contains a graph.
I couldn't find out how to specify the RowSource of the graph. I wanted to supply the rowsource when opening the report, like this.

Dim objGraph As Object
Set objGraph = Me.Histogram
SQLString = " SELECT ........"
objGraph.RowSource = SQLString

The last row however gives an error message - "you have entered an invalid reference to the property RowSourceType".

What am I doing wrong here.
Thanks for the help.
SWK
 
I got over the problem (thanks Pat again) and thought to share how I did it.

Finally I had to modify the rowsource of the chart in design mode and save it in code. Since I work with an Access project and ADO I couldn't play with QueryDef so this ugly thing was the only solution I could find.

DoCmd.Echo False, ""
DoCmd.OpenReport "CutPointHistogram", acViewDesign, "", ""
Reports!CutPointHistogram!Histogram.RowSource = SQLString
DoCmd.RunCommand acCmdSave
DoCmd.OpenReport "CutPointHistogram", acViewPreview, "", ""
DoCmd.Echo True, ""

One more point:
Using Parent-Child field to link the chart to the report made the report run the whole underlying query for each record, which made the report unbearably slow to display (format). To solve this I had to create a temp table before opening the report use that as the rowsource and than drop the table when closing the report.

The whole thing is a mess, but it works.
SWK
 

Users who are viewing this thread

Back
Top Bottom