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

Progress bar while running a query

Status
Not open for further replies.

frontside

Technical User
Sep 26, 2002
85
SE
How do I put a progressbar on a form while I´m running one or several queries in the background.

I´ve been looking at activeX components without much luck.

//Mikael Nilsson
Sweden
 
You can only adjust the progress bar when you are in control.
When you are running a single query you are not in control so any indication of 'progress' would be meaningless.

If you are running a series of queries, then you might be able to give an indication of progress after each statement that runs one of them.
 
While lupin46 is clearly right, and I agree that Progress Bars are mainly a waste of space, it may be possible to give some indication of time to process, if this is on a single machine (roughly):
Code:
Private Sub cmdQuery_Click()
'Microsoft Progress Bar Control 6.0 (SP4)
'Microsoft Progress Bar Control, version 5.0 (SP2)
Dim lngTimeToProcess As Long
Dim dteStart As Date
dteStart = Now()
lngTimeToProcess = 5 'secs
Me.ActiveXCtl2.Min = 1
Me.ActiveXCtl2.Max = lngTimeToProcess
DoEvents
Do While DateDiff("s", dteStart, Now()) <= lngTimeToProcess - 1
'Add 1 to avoid 0
    ActiveXCtl2.Value = DateDiff("s", dteStart, Now()) + 1
Loop
'run query
End Sub


 
Say if you have two macros that run that takes like 4-5minutes each...

DoCMD.runMacro "macro1"
DoCMD.runMacro "macro2"

and i want to show a progressbar during the time that the macros takes to run... how would i do that?

 
I know this doesn't answer your question, but why not use an animated GIF or change the mouse cursor to an Hourglass to indicated something is going on?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top