VBA - Form Progress

D

dbarmer

I have a form that is loaded, and behind this form is VBA code, running both
standard basic code along with database code. On the form I have several
Textboxes that I send data to while looping through data (Me.TextBox) so the
user see's a progress of the program. Two things happen here, (1) If the
user goes away from the display progress form, to the desktop or to another
place within the computer, and then comes back to the access progress form,
IT's solid white.... You can see nothing but an hourglass.

I am using Me.Repaint and Me.Refresh inside of the Do....Loop actions,
however, it still does this no matter how often I refresh/repaint. When the
program finishes, it suddenly comes back to life.

What could be the cause or resolution? It's not computer memory or anything
like that....

Is there a better way to show a program progress?
 
D

Dirk Goldgar

dbarmer said:
I have a form that is loaded, and behind this form is VBA code, running
both
standard basic code along with database code. On the form I have several
Textboxes that I send data to while looping through data (Me.TextBox) so
the
user see's a progress of the program. Two things happen here, (1) If
the
user goes away from the display progress form, to the desktop or to
another
place within the computer, and then comes back to the access progress
form,
IT's solid white.... You can see nothing but an hourglass.

I am using Me.Repaint and Me.Refresh inside of the Do....Loop actions,
however, it still does this no matter how often I refresh/repaint. When
the
program finishes, it suddenly comes back to life.

What could be the cause or resolution? It's not computer memory or
anything
like that....


Your loop should include a DoEvents statement. Does it?
 
D

dbarmer

It does not. Can you elaborate? I am reading both text files and database
files within the do... loops.
 
D

Dirk Goldgar

dbarmer said:
It does not. Can you elaborate? I am reading both text files and
database
files within the do... loops.


The DoEvents statement yields control to Access so that it can process
events. If you're in a tight processor loop, you need to execute a DoEvents
statement to let Access handle its housekeeping, update the display, and
process user actions. Just put a DoEvents statement in your loop, so that
it gets executed reasonably frequently. You could have it executed with
every iteration, or only every n iterations if your loop is very tight and
executing DoEvents every iteration slows it down too much.
 
D

dbarmer

I did an doevent from an VBA example - That made a world of difference!
Thanks so much for your advice!
 

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