Moving a ".dqy" query

YellowBelly

New Member
Joined
Nov 3, 2005
Messages
6
Hello,

I am in a situation involving getting external data from an ODBC connection.

I have a workbook on a networked drive that imports data via a ".dqy" query file which is located on another networked drive. People have been using this sytem to build job reports for the last 6 months or so and have saved each job report as a seperate sheet in the same workbook.
Each time the workbook is opened, they choose "enable automatic refresh" to get updated data for each on-going job and just print the sheets off for analysis.

I have two questions:

1.) Is it possible to move the query file to the same directory as the workbook and somehow "re-link" to it without affecting the data?

2.) When you "save" the query defintion with the workbook via the data range properties dialogue, does it still link to the ".dqy" file or is the connection data magically embedded into the worksheet?


Thanks in advance for any help.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
If I understand this correctly, the dqy files are only used the first time the query is created. After that, Excel stores in the QueryTable object, the information on the connection and the query itself. So, if you move or do whatever with the dqy file after the queries have been created, Excel shouldn't notice.
 
Upvote 0
Thank-you for the quick response Juan.

I used the following VBA code and it gave me the path to my ".dqy" file on my networked drive:

For Each qy In Sheet1.QueryTables
MsgBox qy.SourceConnectionFile
Next

If I delete the ".dqy" file will this not affect my workbook?

Thanks again.
 
Upvote 0
Ah, I don't have that property in Excel 2000, but I do see it in 2003. But I tried this:

1. Create a file, and run a query with a dqy file.
2. Save and close the file.
3. Rename the dqy file
4. Open the file, refresh the query, and everything seemed to work fine.

So, I'd think you would be safe.
 
Upvote 0
Thank-you Juan,

I agree with you that Excel must embed the query into the sheet (via Query Table object) . So the query remains with the sheet no matter what you do to the original.

It is very odd that I cannot edit this query with MS Query though. Every time I click "edit query" MS query flahes in the bottom status bar and then dissapears. That is a pain.

Thanks again for all of your help!
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,216
Members
448,876
Latest member
Solitario

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top