Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoEvents / Loop question

Status
Not open for further replies.

jtseltmann

Programmer
Jan 15, 2002
149
US
I have been reading through the threads on how to effectively use DoEvents and I just have one question. I too have had users see that Windows shows the app as not responding due to a long process and they try go cancel it. My problem or situation is this. I have a huge ascii input file that I am running through and processing. The outer loop rips through this file and has many subprocesses. It takes about 1 second to process each record but sometimes 1-2 hours on the server to complete the process entirely. I have a status field that updates with a "...processing rec 1 - 25 of 500..." so the user knows where the code is in relation to completing. I have a variable set to 'break every xx recs' so this controls when the update is done. The DoEvents call is set inside the Sub that changes the status text.


My question is this...Is this set up ok? The problem in the past is that the db would not regain focus if the user clicked off of it. Now, if the user clicks off...they are allowed to process and if they click back the db regains focus when the DoEvents process is called. Is this adequate?

Thanks for any suggestions.
 
Follow up to this question If I may...

I am noticing in my testing that if the DoEvents is every 25 records then the status in Windows does change to "Running" but only for a few moments...then it goes back to "Not responding".

Should I place a DoEvents call inside the loop each time I make a pass? Right now the call happens about every 20-30 seconds

thanks all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top