PC Review


Reply
Thread Tools Rate Thread

Change database source for pivot table

 
 
Neil
Guest
Posts: n/a
 
      19th Aug 2005
Hi

I've built a pivot table based on an Oracle database.

however I want to change the source database (from test to live) but can't
figure out how to change the source database.

Any ideas?

Cheers

Neil


 
Reply With Quote
 
 
 
 
Neil
Guest
Posts: n/a
 
      19th Aug 2005
Just answered my own question, in the query go into table definition and
change the database

"Neil" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi
>
> I've built a pivot table based on an Oracle database.
>
> however I want to change the source database (from test to live) but can't
> figure out how to change the source database.
>
> Any ideas?
>
> Cheers
>
> Neil
>
>



 
Reply With Quote
 
Neil
Guest
Posts: n/a
 
      19th Aug 2005
Spoke too soon, doesn't seem to pick up the change

Can anyone help?


"Neil" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi
>
> I've built a pivot table based on an Oracle database.
>
> however I want to change the source database (from test to live) but can't
> figure out how to change the source database.
>
> Any ideas?
>
> Cheers
>
> Neil
>
>



 
Reply With Quote
 
=?Utf-8?B?S0QtTXVkZ2Vl?=
Guest
Posts: n/a
 
      22nd Aug 2005
Neil,

I think I've been working on the same problem. I'm connecting to SQL
server - but the following may provide the base for something that will work.

In a new sheet in a new workbook, I filled in the cells as follows:


A B
1 Old Object String DSN=olddb
2 New Object String DSN=newdb




In this workbook, I created the following macro (and ran it with the
workbook I wanted to change open). (Don't ask me to explain - I pilfered the
base of it from somewhere on the net for changing query tables, then spend a
couple of hours trying to work out what pivot table object allowed me to
manipulate a connection).


'------------------------------------------------------------
Sub ChangeConn()

Dim pt As PivotTable
Dim Wsh As Worksheet
Dim Wbk As Workbook

Dim Base

Dim oldString As String
Dim newString As String

Set Base = Range("A1")

oldString = Base.Offset(0, 1).Value 'B1
newString = Base.Offset(1, 1).Value 'B2


For Each Wbk In Workbooks
For Each Wsh In Wbk.Worksheets
For Each pt In Wsh.PivotTables

pt.PivotCache.Connection _
= Replace(pt.PivotCache.Connection, _
oldString, _
newString)
Next pt
Next Wsh
Next Wbk

End Sub
'-------------------------------------------------------------


Hope this helps.


Kim.
--



"Neil" wrote:

> Hi
>
> I've built a pivot table based on an Oracle database.
>
> however I want to change the source database (from test to live) but can't
> figure out how to change the source database.
>
> Any ideas?
>
> Cheers
>
> Neil
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table - Select New Database Source Brig Siton Microsoft Excel Discussion 5 12th Oct 2006 10:53 PM
Change data source for pivot table Michal Microsoft Excel Misc 1 30th Oct 2004 11:55 PM
How to change a pivot table data source Rob Microsoft Excel Discussion 2 11th Aug 2004 07:51 PM
How to change pivot table source database? Steve Microsoft Excel Misc 1 18th May 2004 09:46 AM
Re: Programmatically change database source for pivot George Nicholson Microsoft Excel Programming 1 13th Mar 2004 05:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.