Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Changing ODBC data source for a query embedded in Excel

I have data in an SQL Server and an Excel (2003 sp2) worksheet that uses an
embedded Database Query to retrieve the data. All worked fine until the SQL
Server hosting the data was migrated to a new box.

How does one update the embedded data source to point at the new server?
Every time I open the query, it errors because it cannot connect to the old
server. I have updated the ODBC configuration to point to the new server,
but Excel appears to have retained the original server connection information
and doesn't want to give it up.

Is there any way to change the data source without having to rewrite all the
embedded queries?

The Excel help files show how to create new datasources, but have nothing on
how to updating an existing datasource.
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Changing ODBC data source for a query embedded in Excel

If the Query is run off an Excel macro, then the macro must be edited to
make the change. If you do not have the resources to edit the macro, then a
new one must be recorded using the macro recorder......which incidently
might not work right itself the first time and may need editing itself.
This is one of those things thats kinda/sorta the job for a pro. If you
have a MIS dept, I would turn it in as a trouble report and have them to fix
it since they are the ones who caused it to go bad in the first place.

hth
Vaya con Dios,
Chuck, CABGx3






"Matt Colegrove" wrote in message
...
I have data in an SQL Server and an Excel (2003 sp2) worksheet that uses

an
embedded Database Query to retrieve the data. All worked fine until the

SQL
Server hosting the data was migrated to a new box.

How does one update the embedded data source to point at the new server?
Every time I open the query, it errors because it cannot connect to the

old
server. I have updated the ODBC configuration to point to the new server,
but Excel appears to have retained the original server connection

information
and doesn't want to give it up.

Is there any way to change the data source without having to rewrite all

the
embedded queries?

The Excel help files show how to create new datasources, but have nothing

on
how to updating an existing datasource.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Changing ODBC data source for a query embedded in Excel

Thanks for the response. The macros aren't the problem. The data source
info seems to be embedded in the worksheet and there doesn't seem to be a way
to change it without deleting it and recreating a new query. I need to be
able to change the data source info associated with the query.

"CLR" wrote:

If the Query is run off an Excel macro, then the macro must be edited to
make the change. If you do not have the resources to edit the macro, then a
new one must be recorded using the macro recorder......which incidently
might not work right itself the first time and may need editing itself.
This is one of those things thats kinda/sorta the job for a pro. If you
have a MIS dept, I would turn it in as a trouble report and have them to fix
it since they are the ones who caused it to go bad in the first place.

hth
Vaya con Dios,
Chuck, CABGx3






"Matt Colegrove" wrote in message
...
I have data in an SQL Server and an Excel (2003 sp2) worksheet that uses

an
embedded Database Query to retrieve the data. All worked fine until the

SQL
Server hosting the data was migrated to a new box.

How does one update the embedded data source to point at the new server?
Every time I open the query, it errors because it cannot connect to the

old
server. I have updated the ODBC configuration to point to the new server,
but Excel appears to have retained the original server connection

information
and doesn't want to give it up.

Is there any way to change the data source without having to rewrite all

the
embedded queries?

The Excel help files show how to create new datasources, but have nothing

on
how to updating an existing datasource.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5
Default Changing ODBC data source for a query embedded in Excel

I just found a workaround for this.

Open the worksheet and place the cursor on a cell within the cell range of
the query. Press Alt-F11 to open the VBEditor. Press Ctrl-G to open the
Intermediate window. Type the command: ? ActiveCell.QueryTable.Connection.
The embedded connection string will be echoed back to the screen. Put double
quotes around the string and update the connection information with the new
server info. Move the cursor to the beginning of the connection string and
insert the following in front of the string:

ActiveCell.QueryTable.Connection =

Move the cursor to the end of the string and press enter. This will store
the updated connection string back into the worksheet. Try your query now.

Repeat for any other embedded queries in your worksheet.



"Matt Colegrove" wrote:

Thanks for the response. The macros aren't the problem. The data source
info seems to be embedded in the worksheet and there doesn't seem to be a way
to change it without deleting it and recreating a new query. I need to be
able to change the data source info associated with the query.

"CLR" wrote:

If the Query is run off an Excel macro, then the macro must be edited to
make the change. If you do not have the resources to edit the macro, then a
new one must be recorded using the macro recorder......which incidently
might not work right itself the first time and may need editing itself.
This is one of those things thats kinda/sorta the job for a pro. If you
have a MIS dept, I would turn it in as a trouble report and have them to fix
it since they are the ones who caused it to go bad in the first place.

hth
Vaya con Dios,
Chuck, CABGx3






"Matt Colegrove" wrote in message
...
I have data in an SQL Server and an Excel (2003 sp2) worksheet that uses

an
embedded Database Query to retrieve the data. All worked fine until the

SQL
Server hosting the data was migrated to a new box.

How does one update the embedded data source to point at the new server?
Every time I open the query, it errors because it cannot connect to the

old
server. I have updated the ODBC configuration to point to the new server,
but Excel appears to have retained the original server connection

information
and doesn't want to give it up.

Is there any way to change the data source without having to rewrite all

the
embedded queries?

The Excel help files show how to create new datasources, but have nothing

on
how to updating an existing datasource.




  #5   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Changing ODBC data source for a query embedded in Excel

Cool..........thanks for closing the loop

Vaya con Dios,
Chuck, CABGx3



"Matt Colegrove" wrote in message
...
I just found a workaround for this.

Open the worksheet and place the cursor on a cell within the cell range of
the query. Press Alt-F11 to open the VBEditor. Press Ctrl-G to open the
Intermediate window. Type the command: ?

ActiveCell.QueryTable.Connection.
The embedded connection string will be echoed back to the screen. Put

double
quotes around the string and update the connection information with the

new
server info. Move the cursor to the beginning of the connection string

and
insert the following in front of the string:

ActiveCell.QueryTable.Connection =

Move the cursor to the end of the string and press enter. This will store
the updated connection string back into the worksheet. Try your query

now.

Repeat for any other embedded queries in your worksheet.



"Matt Colegrove" wrote:

Thanks for the response. The macros aren't the problem. The data

source
info seems to be embedded in the worksheet and there doesn't seem to be

a way
to change it without deleting it and recreating a new query. I need to

be
able to change the data source info associated with the query.

"CLR" wrote:

If the Query is run off an Excel macro, then the macro must be edited

to
make the change. If you do not have the resources to edit the macro,

then a
new one must be recorded using the macro recorder......which

incidently
might not work right itself the first time and may need editing

itself.
This is one of those things thats kinda/sorta the job for a pro. If

you
have a MIS dept, I would turn it in as a trouble report and have them

to fix
it since they are the ones who caused it to go bad in the first place.

hth
Vaya con Dios,
Chuck, CABGx3






"Matt Colegrove" wrote in

message
...
I have data in an SQL Server and an Excel (2003 sp2) worksheet that

uses
an
embedded Database Query to retrieve the data. All worked fine until

the
SQL
Server hosting the data was migrated to a new box.

How does one update the embedded data source to point at the new

server?
Every time I open the query, it errors because it cannot connect to

the
old
server. I have updated the ODBC configuration to point to the new

server,
but Excel appears to have retained the original server connection
information
and doesn't want to give it up.

Is there any way to change the data source without having to rewrite

all
the
embedded queries?

The Excel help files show how to create new datasources, but have

nothing
on
how to updating an existing datasource.





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
Changing data source on ODBC query Aussie CPA Excel Discussion (Misc queries) 2 June 14th 07 06:44 PM
Changing ODBC link in a query Keith Excel Discussion (Misc queries) 0 June 13th 07 03:27 PM
Changing Pivot Table Source from ODBC to .odc. njdavies Excel Discussion (Misc queries) 0 February 6th 06 10:29 PM
change odbc data source jenn Excel Worksheet Functions 0 January 20th 06 01:12 AM
Winn98SE, Excel2000: ODBC query opens the source workbook Arvi Laanemets Excel Discussion (Misc queries) 9 March 10th 05 07:32 AM


All times are GMT +1. The time now is 04:01 AM.

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"