Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Child pivot table's source breaking from parent pivot table

I have a workbook with several pivot tables. There is one parent pivot table
that is the source for all child pivot tables. When I manually refresh the
parent pivot table, all child pivot tables are automatically refreshed. This
works great.

The parent pivot table's source is an ODBC connection to our warehouse. I
have to modify the WHERE clause of the SQL statement daily to update the
parent pivot table.

When I use code to alter the SQL of the parent table, all of the child
tables seem to break their source link from the parent, and continue to use
the old ODBC connection and SQL statement.

When I use code to try to repoint the child tables back to the parent, I get
an "Application-defined or object-defined error" error. Here is the snippet
I use to update the parent table (arySQL contains the SQL statement as a
one-dimensional array):

xlWS_Daily.PivotTables("DailyPivotTable").PivotTab leWizard _
SourceType:=xlExternal _
,Connection:="ODBC;DSN=;UID=;;DATABASE=;ACCOUNT=;" _
,SourceData:=arySQL

I use the sparse Connection property, so that the client is prompted for the
ODBC connection every time.

Here is how I'm trying to re-point one of the child tables. This is where I
am getting the error:

xlWS_Monthly.PivotTables("MonthlyPivotTable").Pivo tTableWizard _
SourceType:=xlPivotTable _
,SourceData:="DailyPivotTable"

I recorded a macro of me manually re-linking the tables, and the above
statement was what it grabbed. However, when I'm running the script, it
throws the error.

I know I'm doingn something wrong, but I can't figure it out. Any ideas?

Thanks in advance for any help I can get.

--
Thanks,

Michael Kucan
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table - Parent to Child Data Brennan Excel Discussion (Misc queries) 1 September 24th 08 05:23 AM
Macro to Refresh child pivot table HKS Excel Programming 4 June 12th 08 06:39 PM
VBA code to refresh Child Pivot Table HKS Excel Discussion (Misc queries) 0 May 7th 08 07:49 PM
Code that will rerun or refresh a pivot table (after new data ispasted into the original Pivot Table's Source Range) Mike C[_5_] Excel Programming 3 February 15th 08 06:22 AM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"