Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default query refresh question


i have some code that loops to do multiple queries.
i just use ActiveWorkbook.RefreshAll to refresh with the current parameters.
just have trouble because the code continues running before the query is
finished.

what's the best way to determine when the query is done so i can manipulate
the data before the next query runs?

--

Gary Keramidas
Excel 2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default query refresh question


hi
the freshall command allows for a background querry and it has been my
experience never to allow a background query perticularly if you are going to
be manipulating the query data with more code. the code could start
manipulated data before it is refreshed ie processing old data.
what i always do is refresh each query one at a time by referencing the
query data range.
Application.StatusBar = "refreshing query1"
sheets("sheet1"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = "refreshing query2"
sheets("sheet2"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = "refreshing query3"
sheets("sheet3"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = ""

msgbox "I'm done refreshing now"

more code here.

regards
FSt1



"Gary Keramidas" wrote:

i have some code that loops to do multiple queries.
i just use ActiveWorkbook.RefreshAll to refresh with the current parameters.
just have trouble because the code continues running before the query is
finished.

what's the best way to determine when the query is done so i can manipulate
the data before the next query runs?

--

Gary Keramidas
Excel 2003



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default query refresh question


hi
forgot to mention. not allowing a background query will add so time to the
refresh process but we are not talking hours or even minutes. more like
seconds. the exact time varies depending on how much data you are bringing,
network traffice, other, etc. but it's not a great deal.

Regards
FSt1

"Gary Keramidas" wrote:

i have some code that loops to do multiple queries.
i just use ActiveWorkbook.RefreshAll to refresh with the current parameters.
just have trouble because the code continues running before the query is
finished.

what's the best way to determine when the query is done so i can manipulate
the data before the next query runs?

--

Gary Keramidas
Excel 2003



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default query refresh question


thanks, i changed activeworkbook.refreshall to a cell in the query's range
and added the background refresh code and it seems to work.
ws.Range("A6").QueryTable.Refresh BackgroundQuery:=False
--

Gary Keramidas
Excel 2003


"FSt1" wrote in message
...
hi
the freshall command allows for a background querry and it has been my
experience never to allow a background query perticularly if you are going
to
be manipulating the query data with more code. the code could start
manipulated data before it is refreshed ie processing old data.
what i always do is refresh each query one at a time by referencing the
query data range.
Application.StatusBar = "refreshing query1"
sheets("sheet1"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = "refreshing query2"
sheets("sheet2"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = "refreshing query3"
sheets("sheet3"). range("A1").querytable.refresh Backgroundquery:=False
Application.StatusBar = ""

msgbox "I'm done refreshing now"

more code here.

regards
FSt1



"Gary Keramidas" wrote:

i have some code that loops to do multiple queries.
i just use ActiveWorkbook.RefreshAll to refresh with the current
parameters.
just have trouble because the code continues running before the query is
finished.

what's the best way to determine when the query is done so i can
manipulate
the data before the next query runs?

--

Gary Keramidas
Excel 2003




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 Query refresh question Dave H Excel Discussion (Misc queries) 0 May 2nd 11 04:12 PM
Refresh Query Table causing debug error with Background Refresh pr Gum Excel Programming 2 March 12th 09 10:08 PM
query after refresh question Gary Keramidas Excel Programming 2 August 24th 07 02:25 PM
Timing of automatic query refresh and macro pivot table refresh dutty Excel Programming 2 December 1st 04 07:19 PM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


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

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"