Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

22 views
Skip to first unread message

Jim

unread,
Nov 19, 2004, 2:53:04 AM11/19/04
to
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

0 new messages