Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB for Changing an ODBC connection to Postgres

Status
Not open for further replies.

newbie2009

Programmer
Oct 26, 2009
13
US
Hi everyone...

I need to write a VB procedure for an Excel PivotTable that will change its cached ODBC connection to a new Postgres ODBC connection.

I have part of the procedure written but I get an error when it is switched to the Postgres ODBC connection. My guess is that some of the arguements needed for the Postgres connection are missing.

Can anyone help with writing and posting a VB procedure that would switch from an existing ODBC Oracle connection to a Postgres ODBC connection?

Thanks!!!
 
Also, if it is easier, I will sacrifice the versatility of switching back and forth to just being able to run it to switch it to Postgres.

Thanks again for all your help (and patience).
 



I just ran a test, switchinging between Oracle & Db2.

Check your connect strings!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 



Here's a way to do it.

Right-Click in the PT.

[BACK] to Get Data

[Get Data]

File > New... and change the driver

Conctruct new query

File > Return data to Excel

[Cancel] out

In VBE, run...
Code:
With Thisworkbook.Pivotcaches(1)
   debug.print .connection
End With
Observe you connection string in the Immediate Window.


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top