Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How do I change the datasource location for a query in Excel 2003

I am trying to recreate a report that went wrong for last month, and to do
so, I have to rename the original database so as not to corrupt it. This
means I need to have the Excel template temporarily point to the renamed
database so as to refresh the data using the results from the recovered
database. There has to be an easier way than completely recreating the
spreadsheet to get it to point to the new location of the Access data source.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 171
Default How do I change the datasource location for a query in Excel 2003

For each sheet with a query you need to modify, select the sheet, jump into
the 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
You'll probably be able to figure out what you need it to be, so just change
it:
ActiveSheet.querytables(1).connection = xxxxxxxxxxxx

If you've got multiple queries on a given sheet, repeat the print/update
steps for each index value (querytables(2), etc).
Repeat for each sheet with a query.



"StormKatt" wrote:

I am trying to recreate a report that went wrong for last month, and to do
so, I have to rename the original database so as not to corrupt it. This
means I need to have the Excel template temporarily point to the renamed
database so as to refresh the data using the results from the recovered
database. There has to be an easier way than completely recreating the
spreadsheet to get it to point to the new location of the Access data source.

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
MS Excel 2000 - Change PivotTable DataSource (Access2000 database) Scott Excel Discussion (Misc queries) 0 May 30th 06 03:33 PM
External data query leaves datasource workbook open WhytheQ Excel Discussion (Misc queries) 0 May 4th 06 03:54 PM
Change pivottable datasource zoeloe Excel Discussion (Misc queries) 1 June 21st 05 07:36 PM
Excel 2003 workgroup template location Jon Brooke Excel Discussion (Misc queries) 1 June 9th 05 08:47 PM
Chart DataSource Change jj Charts and Charting in Excel 3 January 20th 05 01:12 AM


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

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

About Us

"It's about Microsoft Excel"