P
patrick
In an MS Access form I am trying to create a stacked barchart with more than one series - or any sort of chart with more than one series! All the examples I can find use hard-coded literal values for the series, but I need to use a datasource. When I do this i get a runtime error "invalid procedure call or argument" when using setdata to assign the values to the series. Code (based on the MSDN examples) is below. Any help anyone please?
Dim rst As New ADODB.Recordset
Const adcmdtable = 1
Const adopenstatic = 3
Const adlockreadonly = 1
Dim owcchartsp As New OWC10.ChartSpace
rst.Open "qryGantt", CurrentProject.Connection, adopenstatic, adlockreadonly
Set owcchartsp.DataSource = rst
Dim owcchart
Dim oseries1
Dim oseries2
owcchartsp.Clear
Set owcchart = owcchartsp.Charts.Add()
Set c = owcchartsp.Constants
owcchartsp.Charts(0).Type = c.chChartTypeBarStacked
Set oseries1 = owcchartsp.Charts(0).SeriesCollection.Add
Set oseries2 = owcchartsp.Charts(0).SeriesCollection.Add
oseries1.Caption = "StartDate"
oseries1.Name = oseries1.Caption
oseries1.SetData c.chDimCategories, 0, "projectname"
oseries1.SetData c.chDimValues, 0, "startdate"
Dim rst As New ADODB.Recordset
Const adcmdtable = 1
Const adopenstatic = 3
Const adlockreadonly = 1
Dim owcchartsp As New OWC10.ChartSpace
rst.Open "qryGantt", CurrentProject.Connection, adopenstatic, adlockreadonly
Set owcchartsp.DataSource = rst
Dim owcchart
Dim oseries1
Dim oseries2
owcchartsp.Clear
Set owcchart = owcchartsp.Charts.Add()
Set c = owcchartsp.Constants
owcchartsp.Charts(0).Type = c.chChartTypeBarStacked
Set oseries1 = owcchartsp.Charts(0).SeriesCollection.Add
Set oseries2 = owcchartsp.Charts(0).SeriesCollection.Add
oseries1.Caption = "StartDate"
oseries1.Name = oseries1.Caption
oseries1.SetData c.chDimCategories, 0, "projectname"
oseries1.SetData c.chDimValues, 0, "startdate"