Set row source of a chart using vb

  • Thread starter Thread starter Jay Easley
  • Start date Start date
J

Jay Easley

I am trying to set the row source of a chart by pressing a
button on a form and opening the report and then edit the
chart's row source, but I'm having trouble. This is what
I've got so far.

DoCmd.OpenReport "bMP_Report_02_Task_Force_Bar_Chart",
acViewDesign
Reports!bMP_Report_02_Task_Force_Bar_Chart!
Graph2.RecordSource = "blah blah"

Please help!

thanks,
Jay
 
Ok, i got that but I'm trying to refrence a value in a
variable for the name of the column and I'm having some
trouble. here's what i got so far

Reports!bMP_Report_02_Task_Force_Bar_Chart!
Graph2.RowSource = "SELECT Manpower_Query.Location,Format
(Sum([Month_1])/173.2,'0.0') AS [July '04] , Format(Sum
([Month_2])/173.2,'0.0') AS [AUG '03]

Any help would be appreciated.

thanks,
Jay
 
Jay,

Try:

"SELECT Location,Format
(Sum([Month_1])/173.2,'0.0') AS [July '04] , Format(Sum
([Month_2])/173.2,'0.0') AS [AUG '03]
Group By Location;"

Make sure your query runs using the query grid then view the query Sql, copy
and paste into your code.

Steve

Jay Easley said:
Ok, i got that but I'm trying to refrence a value in a
variable for the name of the column and I'm having some
trouble. here's what i got so far

Reports!bMP_Report_02_Task_Force_Bar_Chart!
Graph2.RowSource = "SELECT Manpower_Query.Location,Format
(Sum([Month_1])/173.2,'0.0') AS [July '04] , Format(Sum
([Month_2])/173.2,'0.0') AS [AUG '03]

Any help would be appreciated.

thanks,
Jay
-----Original Message-----
Jay,

It's because it's not a RecordSource... try RowSource

Reports!bMP_Report_02_Task_Force_Bar_Chart!
Graph2.RowSource = "blah blah"


Steve





.
 
Back
Top