Add more than one series to a pivot chart using VB MS Access?

J

Jim

I have created a pivot chart using MS visual basic from an example in the
"Programing Microsoft Access Version 2002" by Rick Dobson; however it only
allows for one series to be added. I would like to add a second series to
the line graph programatically, but have been unsuccessful.
The example below is what I've used:

Sub CreateTimeBasedLineChart()
Dim frm1 As Access.Form
Dim strQName As String
Dim strFName As String

'Assign names for query and form
strQName = "qryExtPriceByShipper"
strFName = "frmqryExtPriceByShipper1"

'Create a form based on query
CreateFormBasedOnQuery strFName, strQName

'Open a form in its PivotChart view
DoCmd.OpenForm strFName, acFormPivotChart
Set frm1 = Forms(strFName)
frm1.ChartSpace.DisplayFieldButtons = False

With frm1.ChartSpace
'Open PiovtChart without drop areas, and set its categories and values
.SetData chDimCategories, chDataBound, "[YearMonth]"
.SetData chDimValues, chDataBound, "ExtPrice"
.Charts(0).Type = chChartTypeLineMarkers

'Assign and format titles to axes and overall chart
With .Charts(0)
.Axes(1).Title.Caption = "Sales ($)"
.Axes(0).Title.Caption = "Dates"
.HasTitle = True
.Title.Caption = "Sales By Month"
.Title.Font.Size = 14
End With
End With

'Close form and save PivotChart view
DoCmd.Close acForm, strFName, acSaveYes

End Sub
 

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