How do I bind a Chartspace object to a parameter query?

A

Ace Calhoon

Hello,
I have a chartspace object on an Access generated Data Access Page. I
would like users to be able to manipulate the data viewed on this chart
by means of several controls on the page. At first glance, a parameter
query seemed like the best way to implement this.

Unfortunately, I can't seem to bind the Chartspace object's DataSource
property to a recordset that has been generated from an ADO Command.
When I do, the chart contains no fields... Even though I can
independently query the recordset for a value.

My code (in vbscript) follows:

Dim Cnn
set cnn = createobject("ADODB.connection")
cnn.Provider="Microsoft.Jet.OLEDB.4.0"
cnn.Open "m:\database\htqadata_be.mdb"
dim cmd1
set cmd1=createobject("ADODB.command")
cmd1.activeconnection=cnn
cmd1.commandtext="SELECT * FROM AuditFindings WHERE Line=Display"
cmd1.parameters("Display")=chtDisplay.Selection.getvalue(chtDisplay.Constants.chdimcategories)
dim rs
'set rs=cmd1.execute
set RS = CreateObject("ADODB.Recordset")
set RS.ActiveConnection = cnn

RS.CursorType = adOpenStatic
RS.CursorLocation = 3'adUseClient? Using the symbolic name results in
a bad parameter error.
rs.open cmd1
set chtdisplay.DataSource = rs
chtdisplay.Refresh

chtDisplay.ChartSpaceTitle.Caption= "Nonconformance Classifications for
" & chtDisplay.Selection.getvalue(chtDisplay.Constants.chdimcategories)
chtDisplay.charts(0).HasLegend=true
chtDisplay.Charts(0).Type=chtDisplay.Constants.chChartTypePie3D
gstrolddatamember = chtDisplay.DataMember

'Code below here fails... Fields do not exist?
'chtDisplay.SetData
chtDisplay.Constants.chDimCategories,chtDisplay.Constants.chDatabound,"Classification"
'chtDisplay.SetData
chtDisplay.Constants.chDimValues,chtDisplay.Constants.chDatabound,"Classification"

Thanks for any help...
 

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