Question Progress Bar

asif pasha

Registered User.
Local time
Today, 15:52
Joined
Jan 8, 2010
Messages
60
Hi,

I have created a button, when you clicked a no of queries will run simultaneously, ex: merging of data from one table to other, copy of data etc. I am looking for a progress bar where in if one query is in progress the progress bar should show the status and the query name which is running currently.
Also how much time it require to complete the whole process. Similar when to when an application is installed.

For your information i'm using A97.

An example would be great help.

Thanks in advance.
 
Look in the sample database section there are a number of Progress bar database's you can use.
 
Thanks for the reply,

I tried searching it, however i can't open because i'm using A97. If possible please convert the database into 97 and attached.

Regards,
asif
 
Asif,

The code you need is shown below:

Place this code in a new module in your database.

Option Compare Database
Option Explicit
Function RunProgressBar(lLth As Long)
If IsLoaded("frmSplash") Then
Forms!frmSplash!Box20.Width = lLth
End If
End Function
Function IsLoaded(ByVal strFormName As String) As Boolean
On Error GoTo Err_IsLoaded
Const conObjStateClosed = 0
Const conDesignView = 0
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
If Forms(strFormName).CurrentView <> conDesignView Then
IsLoaded = True
End If
End If
Exit_IsLoaded:
Exit Function
Err_IsLoaded:
MsgBox Err.Description, , " Service Operations"
Resume Exit_IsLoaded
End Function
Public Function Pause(NumberOfSeconds As Variant)
On Error GoTo Err_Pause
Dim PauseTime As Variant, Start As Variant

PauseTime = NumberOfSeconds
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop

Exit_Pause:
Exit Function

Err_Pause:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Pause

End Function


On the form you will need to add a rectangle shape and name it Box21 and add the code behind the form as follows:

'Alter value below to change speed
Const Steplth = 15
Private Sub Form_Load()
On Error GoTo Err_Form_Load
lbarlnth = Me.Box21.Width - 30
l = 0
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
End Sub
Private Sub Form_Timer()
On Error GoTo Err_Form_Timer
Do Until l >= lbarlnth
Call RunProgressBar(l)
l = l + Steplth
Pause 0.01
Loop
Pause 2
DoCmd.Close acForm, Me.Name
Exit_Form_Timer:
Exit Sub
Err_Form_Timer:
MsgBox Err.Description
Resume Exit_Form_Timer
End Sub
 
Sorry to ask this silly question,

What is 'lbarlnth = Me.Box20.Width - 30' 'l = 0'

Because i am getting an error variable not defined, i tried defining as integer and string, however error.
 
Sorry to ask this silly question,

What is 'lbarlnth = Me.Box20.Width - 30' 'l = 0'

Because i am getting an error variable not defined, i tried defining as integer and string, however error.

Box20 is the name of the text box in the sample code. Change it to the name of your text box.
 
If you look closely at both codes there are 2 boxes I think the the second is the one that will expand during the time event so you need both and the second one needs a colour fill.
 

Users who are viewing this thread

Back
Top Bottom