Chart RowSource problem in Report

  • Thread starter robert demo via AccessMonster.com
  • Start date
R

robert demo via AccessMonster.com

Has anyone run into a problem with using the RowSource property for a chart
in a report. The line of code is:

Me.Usage_Chart1.RowSource = "Some SQL Select Statement"

I keep getting the following error:

"You entered an expression that has an invalid reference to the property
RowSource"


I'm quite certain that the SQL Select statement is fine. When I take the
Select statement and remove the quotes and place it in the RowSource line
of the Data tab of the Properties sheet for the chart, the chart displays
fine. However, I can't just leave it at this, because there is one
parameter variable in the Select statement that varies depending upon user
selected criteria (when I placed the statement in the RowSource line, I
selected a specific parameter).

I have charts in forms that use identical code and they work fine.

One potentially important thing I've noticed. When I type the following in
the VBA editor in a form:

Me.Usage_Chart.RowSource

I noticed that as I'm typing a list comes up after "Chart." that allows me
to select a property. The property RowSource is in that list on the FORM
VBA code. It is NOT in the list for the REPORT VBA code.

Could this be the problem? I've heard that Access reports have "issues".
Has anyone experienced this one?

Thanks.
 
R

Rob Parker

Hi,

I played with this a while ago, trying to help another poster with a similar
problem. I used the following workaround to change the chart rowsource in a
report. It involves opening the report in design mode (hidden, so user
doesn't see things flicking on and off), then chaninging the chart
rowsource, saving the report, and re-opening it (it this example in preview
mode, but you could open in print mode instead).

This code was run from a button on my chart test form, but you could put it
elsewhere.

Private Sub btnReport_Click()
'Last edited: 3 May 2005, Rob Parker
DoCmd.OpenReport "rptChartTest", acViewDesign, , , acHidden
Reports("rptChartTest").TestChart.RowSource = "tblChartTest2"
DoCmd.Close acReport, "rptChartTest", acSaveYes
DoCmd.OpenReport "rptChartTest", acViewPreview
End Sub

HTH,

Rob
 

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