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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating a progress meter

Status
Not open for further replies.

dakota81

Technical User
May 15, 2001
1,691
US
On long tasks I want a progress meter that shows the user how much longer it's going to take. Each one is basically this format:

Do Until rstRecordset.EOF
[ProgressLabel].Caption = Int(rstRecordset.PercentPosition) & "%"
DoEvents
....
Loop

Works good in displaying a progress meter on the form, but is there a different way I can make this work without the DoEvents command? Because with that command in there, the user could perform other tasks like click other buttons on the form and possibly screwing up the running task or pull up incomplete information.

Can I instead of DoEvents, run the specific event that will refresh the label on the form? Is there an alternate way to run a progress meter?

FYI, I'm running Access 97 if that means anything.
 
Hi,

You tried leaving 'DoEvents' out altogether?

DoEvents enables user to carry on working.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Without the DoEvents command, the label's caption is never refreshed until the current event is finished (almost always a command button's on_click event in my cases). When the button is clicked, the data I need is gathered and processesed, but you don't see any progress indication on the screen until the very end when the caption switches from blank to "100%". Of course, this entirely defeats the purpose of a progress meter.

But with the DoEvents command left in, the user has too much freedom to click other buttons in the form, change text fields, or even close the form down while the data is trying to be gathered and processed.

While replying to this message, I thought of working it through the Timer event, and while that would work well for a progress meter, it introduces a new problem (which I've run into before by accident); when a timer event occurs, the focus is switched to the form of who's timer event is running. On screen though it looks normal, you do not switch to view the other form - but there are several macros which act upon the form that has the focus, not neccessarily the form that the macro was run from or which is view on the screen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top