Link to home
Start Free TrialLog in
Avatar of stratari
stratari

asked on

Progress bar

I got a report that takes quite a time to display (20 secs on a Celleron 300@450) and the cursor doesn't change to a hourglass. That way, in slower machines, people think that nothing happens. Is there a way to display something like a progress bar?
Avatar of smilitaru
smilitaru
Flag of Romania image

You can force the cursor to hourglass before openning the report and change back after formatting the report footer. If you have not report footer you can insert a 0 height report footer in order to use his event.
Changing the mouse pointer you can do with:
DoCmd.Hourglass True
or
DoCmd.Hourglass False

This is not a truly answer for your question so I left question opened for someone who knows about progress bar.

Avatar of stratari
stratari

ASKER

I preffer a progress bar but it would be nice if your suggestion works too.
I added DoCmd.Hourglass True  in Report.open and DoCmd.Hourglass False in Report.footer but nothing seems to happen.
I even tried the true statement in page header and report header...
Hi,

I could post a true graphical progress bar (not X specials chars in a text box) using 1 form and 2 functions. It works for any jobs when you want to display a nice mini-form with a bar and a cancel button to stop the current process but I don't know if it could fit your request...

The main function has many parameters like the lenght of progress bar, true/false to allow or not the cancel and the text above.

It does not use activex or lib. Only things Access allow without specific knewledge.

DS
dsegard
I think stratari problem is not just a nice progress bar, the problem is how to advance this progress bar when the report is formating.

stratari.
Put the Hourglass = True BEFORE openning the report and try using a DoEvents after Hourglass = True.
Do you can step the progress bar on OnFormat event of your detail section?
You must insert a DoEvents after every step of your progress bar.

Yes, I understand the problem. But in many cases, Access seems "freezed" without any information. Because I was quite fed up with these, I went on with a personal solution. My comment was first to know if it could bring an alternative to stratari. Not more, not for... "look to my nice progress bar" ;)
dsegard
I think stratari problem is not just a nice progress bar, the problem is how to advance this progress bar when the report is formating.

stratari.
Put the Hourglass = True BEFORE openning the report and try using a DoEvents after Hourglass = True.
Do you can step the progress bar on OnFormat event of your detail section?
You must insert a DoEvents after every step of your progress bar.

I'm sorry for repeating my last comment, but I have trouble with internet connexion
Using the syscmd function you can create a progress bar. It wouldn't move much between the opening of the report and the final display. If that sounds ok I'll be glad to help.
dsegard:
Please tell me more!
smilitaru:
I added the 'DoCmd.Hourglass True' and 'DoEvents' lines to the onclick property of the button that opens the report and 'DoCmd.Hourglass False' to the report footer. It seems that the pointer changes to Hourglass AFTER the report opens and stays that way. Maybe I'm doing something wrong.
pwians:
Please tell me more!
I don't think it'll help you in this case but if you want...
DS
ASKER CERTIFIED SOLUTION
Avatar of pwinans
pwinans

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The hourglass doesn't behave like it's supposed to do but the progress bar is useful. Thanks
What if you do something like run some other code or just add a stop where the openreport is - does the hourglass work then?
If I remove the gourglass false then the cursor changes to hourglass AFTER the report is being displayed.
Ok, but what happens if instead of opening the report you make a msgbox pop up? Does the hourglass command do what it is supposed to? In other words, replace your code with this (don't save changes of course):

with docmd
        'Start your bar with text and # of increments
        syscmd acSysCmdInitMeter, "Opening the report ...", 2
        .hourglass true
        'Increase the increment to look like something is happening
        syscmd acSysCmdUpdateMeter, 1
        'Open a msgbox
        msgbox "Piece of ..."
        'Take away the meter
        syscmd acSysCmdRemoveMeter
        .hourglass false
       end with
When the message box is up, is the mouse icon a pointer or an hourglass (when it is no over the msgbox)?
It works fine with the msgbox. But when I put the openreport the hourglass goes for a vacation! :-)
    SysCmd acSysCmdInitMeter, "Opening the report ...", 2
    DoCmd.Hourglass True
    SysCmd acSysCmdUpdateMeter, 1
    DoCmd.OpenReport stDocName, acPreview
    SysCmd acSysCmdRemoveMeter
    DoCmd.Hourglass False
OK pwinans I got it right!
The key was to put the progress bar commands in the report's code and not in the button. I now can turn the hourglass on, advance the progress bar as the calculations are taking place and then turn the hourglass off!
Thanks for your help!
:-))