Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Updating Querytables and Pivottables

I have a workbook with three worksheets. Sheets 1 and 2 contain
pivot-tables whose source is a query-table in sheet 3 whose source is a
local Access mdb table. The workbook also has a module that contains
two procedures. 'Sub UpdateQT' uses 'querytable.refresh' to update
sheet 3 and 'Sub UpdatePT' uses pivottable.refreshtable to update
sheets 1 and 2.

Initially the query-table was linked to an Access table that the
following:
Field1, Field2
A 1
B 2

I added data to the table:
Field1, Field2
A 1
B 2
E 3

Then I first ran querytable.refresh on sheet 3 and followed by
pivottable.refreshtable on sheets 1 and 2. The new third row of data
(E-1) appeared in the query-table but not in the pivot-tables.

Then I deleted the third row of data from the access table leaving only
the two rows with A-1 and B-2. I first ran querytable.refresh on sheet
3 and followed by pivottable.refreshtable on sheets 1 and 2. The
query-table then contained A-1 and B-2, but the pivot-table contained
A-1, B-2, E-3; the refreshtable method is always one data set behind.

Without any changes to the source data, running the two procedures a
second time gets the two pivot-tables back in sync with the
query-table. All three contain A-1, B-2.

Since .refreshtable is always one data set behind I thought running
..PivotCache.Refresh and the .refreshtable would get the pivot and query
tables in sync but it didn't.

Anyone have any ideas on how to get the update process to work in one
pass rather than two?

Buck

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Updating Querytables and Pivottables

Sounds like you are executing these refresh commands in code and you have
backgroundquery set to True. Set backgroundquery to False and it should
solve your problem.

--
Regards,
Tom Ogilvy

"Buck" wrote in message
oups.com...
I have a workbook with three worksheets. Sheets 1 and 2 contain
pivot-tables whose source is a query-table in sheet 3 whose source is a
local Access mdb table. The workbook also has a module that contains
two procedures. 'Sub UpdateQT' uses 'querytable.refresh' to update
sheet 3 and 'Sub UpdatePT' uses pivottable.refreshtable to update
sheets 1 and 2.

Initially the query-table was linked to an Access table that the
following:
Field1, Field2
A 1
B 2

I added data to the table:
Field1, Field2
A 1
B 2
E 3

Then I first ran querytable.refresh on sheet 3 and followed by
pivottable.refreshtable on sheets 1 and 2. The new third row of data
(E-1) appeared in the query-table but not in the pivot-tables.

Then I deleted the third row of data from the access table leaving only
the two rows with A-1 and B-2. I first ran querytable.refresh on sheet
3 and followed by pivottable.refreshtable on sheets 1 and 2. The
query-table then contained A-1 and B-2, but the pivot-table contained
A-1, B-2, E-3; the refreshtable method is always one data set behind.

Without any changes to the source data, running the two procedures a
second time gets the two pivot-tables back in sync with the
query-table. All three contain A-1, B-2.

Since .refreshtable is always one data set behind I thought running
.PivotCache.Refresh and the .refreshtable would get the pivot and query
tables in sync but it didn't.

Anyone have any ideas on how to get the update process to work in one
pass rather than two?

Buck



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Updating Querytables and Pivottables

"qt.Refresh False" did the trick.
Thanks

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
listobjects and querytables S. Parker Excel Programming 0 November 14th 05 09:08 AM
ActiveSheet.QueryTables.Add quartz[_2_] Excel Programming 0 November 9th 05 07:18 PM
QueryTables Add Marta[_3_] Excel Programming 0 January 19th 05 05:32 PM
QueryTables Error Sharlene England Excel Programming 3 August 19th 04 10:36 PM


All times are GMT +1. The time now is 02:20 PM.

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"