Progress bar

S

Silvio

How can I concatenate the status bar to my progress bar? Rigt now the progres
bar runs and then displays the query results. In few words, the progress on
my form does not reflets the actual progress % like the one in the status
bar. I did read several comments in this forum on progress bar, however I
think I am missing out the main thing: how to link the progress bar to the
actual opreation time when run a query or a report that takes several second
to make the calculation and then display. Any idea?

Dim inti As Integer
Dim dblPct As Double
Me.txtPctComplete.Visible = True
Me.boxWhole.Visible = True
Me.boxPct.Visible = True

Do Until inti > 500
dblPct = inti / 500
Me.txtPctComplete = dblPct
Me.boxPct.Width = Me.boxWhole.Width * dblPct
DoEvents
inti = inti + 1
Loop

Me!frmReport.Form.Requery
Me.Caption = "Reports Menu"
 
H

HiTechCoach via AccessMonster.com

A progress bar does not show the "actual opreation time" but the steps
completed.

To use a progress, you need to have some VBA code performing a loop.Within
you code look, you will update the progress bar. You can not insert code to
update you progess bar within an action query or opening a report.
 
M

Marshall Barton

Silvio said:
How can I concatenate the status bar to my progress bar? Rigt now the progres
bar runs and then displays the query results. In few words, the progress on
my form does not reflets the actual progress % like the one in the status
bar. I did read several comments in this forum on progress bar, however I
think I am missing out the main thing: how to link the progress bar to the
actual opreation time when run a query or a report that takes several second
to make the calculation and then display. Any idea?

Dim inti As Integer
Dim dblPct As Double
Me.txtPctComplete.Visible = True
Me.boxWhole.Visible = True
Me.boxPct.Visible = True

Do Until inti > 500
dblPct = inti / 500
Me.txtPctComplete = dblPct
Me.boxPct.Width = Me.boxWhole.Width * dblPct
DoEvents
inti = inti + 1
Loop


I have never heard of a way to retrieve the status bar info
for an autonomous operation such as a query. OTOH, if you
are using SysCmd to control the status bar, then you know
the values it is displaying.

That seems to be rather obvious so I suspect your question
is really about how to get the form's control to display in
sync with the loop. Drawing the form on the screen is a
separate task (from your code execution task) that runs at a
lower priority so it normally lags behind what you would
expect if everything were single threaded. Unfortunately,
syncing these tasks often takes a somewhat mysterious
incantation of statements. With luck, using Me.Repaint is
sufficient, but sometimes, as you are doing, DoEvents is the
magic word. There seem to be times when the Repaint needs
to be followed (and maybe even preceded) by DoEvents. If
all those fail to produce the desired effect, the last
resort is to add additional DoEvents statements or just
chalk it up as one of those situations beyond human
comprehension.
 

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