Pivot Table on subform

denomc100

New member
Local time
Today, 22:38
Joined
Dec 10, 2012
Messages
8
Hi,

I'm trying to set the fields on a pivotchart view embedded on a tab form, but I just can't get the code right.

Form Name : [Input_Form]
Tab Name: [Reports]
Chart Name: [PivotChart]

Any help will be appreciated.

Denis :banghead:

Sub Test()

Dim fset1, fset2, fset3 As Object
DoCmd.OpenForm ("Input_Form"), acNormal
With Forms![Input_Form].[PivotChart].PivotTable.activeview
Set fset1 = .FieldSets("PA_Groupings")
Set fset2 = .FieldSets("OrderID")
Set fset3 = .FieldSets("Amt")
.RowAxis.InsertFieldSet fset1
.ColumnAxis.InsertFieldSet fset2
.DataAxis.InsertFieldSet fset3
End With
 
Hello and Welcome to AWF.. :)

There are several bitter facts about VBA.. one of which is, unlike other Programming Language, you cannot simply declare all variables finally use the Type, in VBA you have to specify every variable with its type..

So based on your declaration statement only fset3 is declared as Object the rest would be just Variants.. try..
Code:
Dim fset1 As Object, fset2 As Object, fset3 As Object
 
Thanks for the quick responce, but it didn't resolve it.

It seems to be this line that's the issue
With Forms![Input_Form].[PivotChart].PivotTable.activeview

I got the standalone pivotTable to work, but it's having the subform seems to be the issue.

Thanks
Denis
 

Users who are viewing this thread

Back
Top Bottom