Frozen form with long process

  • Thread starter Thread starter Xav
  • Start date Start date
X

Xav

I've got a simple application with one button control in my form that
triggers a few queries which take a few minutes to run. I use a label
control to display the information about which query is currently
running. My problem if I swap to any other application and come back to
Access I got a nice/annoying white screen. I would also like to be able
to abort the process at any time. Any idea?

Thanks,
 
Try putting in some calls to the DoEvents function.

DoEvents passes control to the operating system. Control is returned after
the operating system has finished processing the events in its queue and all
keys in the SendKeys queue have been sent.
 
In additions to Douglas' recommendation, you may try an occasional Me.Repaint
I have had the same issue with some long running process.
 
Thank you both for your advice. Actually those information don't fix my
white screen problem when I swap to another application (IE for
instance) and bring up back MS Access (while still processing). Is
there a way to run a query in a independant thread in order to free the
Form from any work? (Same problem if I want to move the Form when it is
running a long query, the form is just stuck waiting the process to
finish).
 
If you are executing a query that take a long time to process, then there is
not much you can do about that because your code is waiting for the query to
complete execution.
I don't know if this would improve the circumstances or not, but I had a
thought. (weigh in here Douglas) If you put the code that executes the query
in a hidden form, then rather than run the query from your visible form, open
the hidden form and have it execute the query. It might be necessary to pass
focus back to the visible form before the query actually starts running.
Again, I have no idea if this will work, it is only an idea.
 
No, as you say, if the query is taking that long, there's really nothing you
can do about it.

I don't believe using a hidden form will help. In fact, it may hinder, since
you won't have any indication that something is supposed to be happening.
(Remember, Access is single threaded)
 
I think you are probably right. Oh well.
If it is really an issue, the only other alternative I can think of is to
use VBA to manipulate the data so you have a control loop you can break into.

Do While Not rst.EOF
'Do Stuff
DoEvents
Me.Repaint
rst.MoveNext
Loop
 
Back
Top