• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Run Time Error 1004

tamarb55

New Member
Hey!

I hope to get you'r help..

I get combobox in me excel, that when select from the list my pivot table change = just like a pivot table filter.
So far so good :)

my problem start when i choose a specific item from my combobox i get:

"run time error 1004 unable to get the pivotfields property of the pivot table class"

this is my vba code:
Code:
Private Sub ComboManager_Change()

    Dim sheet As Worksheet
    Dim pt As PivotTable
    Dim ptField As PivotField
    Dim pi As PivotItem
    Dim i As Integer
    Dim connections As String

    Application.EnableEvents = False
    Application.ScreenUpdating = False
  
  
    Set sheet = ThisWorkbook.Worksheets("View")
    Set pt = ActiveSheet.PivotTables("PivotTable1")
    Set ptField = pt.PivotFields("Department Manager")
    ptField.CurrentPage = Me.ComboManager.Value
  
    ActiveWorkbook.connections("Query from MS Access Database").Refresh
      Application.EnableEvents = True
    Application.ScreenUpdating = True

End Sub
Thanks!!!

Tamar.
----
Mod Edit:
Cross posted here:
http://www.ozgrid.com/forum/showthread.php?t=194177
 
Last edited by a moderator:
Verify that
a) you have a field in PT, currently in the PivotTable, labelled "Department Manager"
b) double-check the name, make sure there's no trailing/leading space
 
Hey Thanks for Answer back so fast.

That what confusing because when i choose some other items from selections in me combobox it works perfect .

If I delete that line from the code:

Code:
 &
ActiveWorkbook.connections("Query from MS Access Database").Refresh
Me.ComboSupervisor.Value = Clear

It works perfect -

i have data connections that i need to refresh because is another combobox that depend on the first one

i will try to upload a file for example

Regards,
Tamar.
 
Back
Top