Changing ODBC

G

Guest

I have a large spreadsheet with an ODBC link into our main company database.
It then feeds several Pivot tables.

I now need to keep the spreadsheet but change which ODBC link the query is
using. How can I do this? So far apart from when you first create the query
I can't see any way to change it later.
 
G

Guest

I'd select the sheet with the link, jump into my VB Editor (Alt + F11), then
open up an immediate window (View / Immediate Window, if it's not already
visible). To see what the current connection is, type the following line in
the immediate window, followed by enter:
Print ActiveSheet.querytables(1).connection
Hopefully the result makes enough sense that you can figure out what you
need it to be, so then just change it:
ActiveSheet.querytables(1).connection = xxxxxxxxxxxx
HTH. --Bruce
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top