View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] DapperDanH@nospam.nospam is offline
external usenet poster
 
Posts: 4
Default Pivottables from external sources

Hello
I have created a pivot table from an external source. The external source is a Access database that is in the same directory as the excel workbook.

The issue is that Microsoft Query automatically modifies my SQL statement to include a hardcoded path to the database

For example, "Select * FROM MyTable" changes to

"SELECT * FROM `C:\Program Files\MyFolder\db`.MyTable

If I send the db and excel file to someone, and they do not put in the exact folder, the pivottable does not know where to get data from

My questions are
1. Can I prevent the hardcoded path
2. Is there a way to dynamically through code on sheet startup, to modify the SQL statement to have a different path? The "layout" of the pivottable would need to be persisted and/or recoded
3. Any advice would be appreciated

Thanks and I look forward to your response

Dan