Progress Bar..how?

G

Guest

Hi,

I am using MS ACCESS 2003.
I placed MS Progress Bar Control 6.0 over the form.

When event is fired, progress bar has to be working. When another event is
fired,
the progress bar will be stop. BTW, PB is the instanace of the progress bar
control.

Dim currentWorking as Boolean

Private Sub Do()
Start ' it invokes StartProgress method

.....
...

End ' it invokes EndProgress method

End Sub

Private Sub StartProgress()
currentWorking = True
While currentWorking
PB.Value = i
i = i + 1
If i > PB.Max Then
i = 1
End If
Wend
End Sub

Private Sub EndProgress()
currentWorking = False
End Sub

Actually I thought.....vb event is async, so...
As long as currentWorking is True, progress bar will be updated, once
another event is invoked to EndProgress, currentWorking will be False, so
progress will be stop......However, it wasn't.... it goes to infinitely
looping..

How do I modify above code to work as I expected in vba?

Thanks.

...............................................................TJ
 
M

Michel Walsh

Hi,


A solution to try is to use

DoEvents


to break the flow of execution, allowing other pending code (Event, Timer,
Painting... ) to occur before resuming. I would try to insert it immediately
before the loop makes its test (a second choice is immediately after it did
it).

Hoping it may help,
Vanderghast, Access MVP
 

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

Similar Threads


Top