LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Re-assigning CommandText to an existing PivotCache

Hi,

I'm trying to write some VBA code to ask the user the new location of an
Access database that is used as the source for an Excel PivotTable, then
points that PivotTable to the new connection.

Pseudo code is this:

With ActiveWorkbook.PivotCaches(1)
.Connection = strDBConn
.CommandText = strDBCTxt
End With

Where strDBConn is the connection string and strDBCTxt is the SQL for the
query. The first part (.Connection) works fine, but Excel halts with a "1004
error" on the assignment of CommandText.

I have checked the contents of the string - and done two tests: first,
re-write the code to create a new PivotCache which works with strDBConn and
strDBCTxt; then a test of the original method where it assigns the current
contents to a temporary string, then re-assigns it back, but it still falls
over with the same error.

What am I doing wrong?

Thanks,
Mark

 
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
Help! Stupid CommandText Problem El Pablo[_2_] Excel Programming 0 July 4th 06 08:30 PM
CommandText Simon Shaw Excel Programming 7 July 4th 06 07:05 PM
Setting CommandText property of PivotCache fails if cache has 1 PivotTable ashortxl Excel Programming 1 May 20th 05 10:27 PM
CommandText Property Dick Kusleika[_3_] Excel Programming 0 October 17th 03 11:04 PM
change commandtext in pivotcaches patrick Excel Programming 3 September 2nd 03 03:06 PM


All times are GMT +1. The time now is 04:24 PM.

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

About Us

"It's about Microsoft Excel"