Multiple MS-Queries in the same Workbook

JWGoldfinch

Board Regular
Joined
Dec 23, 2009
Messages
50
I have a workbook with multiple MS-Queries built into it. These are ODBC access to data on an IBM iSeries 400. I need to know if there is a way to have the queries process in a given order. Example Query 1 is dependent on the results of query 2. Currently when I press "Refresh All" it runs the in order 1 then 2, I then have to refresh query 1 separately again to gain the desired results. This would not be bad if the workbook only had 2 queries, but I have workbooks with as much as 8 queries (Or More) and if there were 8 I might need them processed (4,1,2,5,3,7,6,8) when query 4 depends on results from query 8, Etc. Is there a way to give Excel an order of processing? Any Assistance would be greatly Appreciated.
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Yes there is a way - refresh the queries individually in the order wanted. This is the default in Excel I work in - there is no 'Refresh All' for me (except in VBA).

I don't know your Excel version but I expect this will work - try selecting a cell in the resultset/table/output then ALT-D-R to refresh that query, And so on for other queries.

You may find it easier with VBA. Again, without specifics of your Excel version I can't advise specifics. Maybe best you use the macro recorder & modify the generated code. Basic idea is something like,

worksheetTwo.HoweverQueriesAreReferencedOnYourVersion(m).refresh
worksheetOne.HoweverQueriesAreReferencedOnYourVersion(n).refresh
worksheetThree.HoweverQueriesAreReferencedOnYourVersion(p).refresh

Check too that the queries have backgroundquery set to false - so that the query refresh won't be done in the "background" and allow other calculations to be done before it finishes.

PS. Different versions of Excel VBA refer differently to query objects. Hence I can't advise specifics. The macro recorder should show what you need, or otherwise google.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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