How Do I Get The Screen To Repaint?

G

Guest

I have a form that has a bunch of option boxes. The user selects the options
desired, and hits the "Go" button (which starts a bunch of VBA code that
drives the process). After that, a series of queries are run - sometimes
numbering in the hundreds. A progress bar control and status text box tell
the user how far into the process he/she is.

The problem is that if the user hits "Go", and then opens a different window
on top of the active form (say, to check email), then goes back to the form,
the Access window and form no longer update their contents. As long as the
user leaves that window on top, the display works fine. As soon as another
window covers it up, that window no longer updates itself until the entire
process is finished - which can take up to half an hour.

Is there something in VBA that I can call to force the screen to update
periodically? I tried Me.Repaint (with Me being the active form), and it
didn't work.

Thanks,

Eric
 
G

Guest

Since I don't know if your VBA is in a loop during the query process or if it
is inline, I will have to give a generic answer and you will have to figure
out where to put the code.
If it is a loop, I would put a DoEvents at the top of the loop; otherwise, I
would put a DoEvents occasionally in the code.
If that is not sufficient, follow it with Me.Repaint
 
G

Guest

Most of the queries are in loops, so I stuck the DoEvents wherever I updated
the value of the progress bar or status text. Worked like a charm!

Thanks,

Eric
 
G

Guest

Great.
Access is a real hog. As long as he has something to do, it seems he
totally ignores Windows and anything else going on.
--
Dave Hargis, Microsoft Access MVP


egun said:
Most of the queries are in loops, so I stuck the DoEvents wherever I updated
the value of the progress bar or status text. Worked like a charm!

Thanks,

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top