I have some reports that are taking quite awhile to run and open (connecting to a MySQL server over the internet).
I have several good examples of progress bars, but they all have coding that is driven by a timer or a set number of iterations.
I know that I am supposed to substitute the number entered (like 1200) with the recordset count and move the bar as the recordset is processed. But I don't know how.
Here is the code of the bar I was thinking of using:
Thanks. Sean.
I have several good examples of progress bars, but they all have coding that is driven by a timer or a set number of iterations.
I know that I am supposed to substitute the number entered (like 1200) with the recordset count and move the bar as the recordset is processed. But I don't know how.
Here is the code of the bar I was thinking of using:
Code:
' Module : Form_frmShowProgress
' Description:
' Procedures : UpdateCurStep(pintCurStep As Integer)
' Let NumSteps(pintStrEventFunction As Integer)
' cmdGo_Click()
' Form_Open(pintCancel As Integer)
' Modified : 10/21/02 - 16:33
' Author: Sandra Daigle
' 10/21/02 SMD Cleaned with Total Visual CodeTools 2002
'
' --------------------------------------------------
Private Const mcStrModule As String = "Form_frmShowProgress"
Option Compare Database
Option Explicit
Private mintNumSteps As Integer
Dim fInLoop As Boolean
Dim fExitLoop As Boolean
Public Sub UpdateCurStep(pintCurStep As Integer)
' Comments :
' Parameters: pintCurStep -
' Modified : 10/21/02 - 16:33
'
' --------------------------------------------------
'TVCodeTools ErrorEnablerStart
On Error GoTo Proc_Err
'TVCodeTools ErrorEnablerEnd
Dim inti As Integer
Dim dblPct As Double
dblPct = inti / Me.txtNumIterations
Me.txtPctComplete = dblPct
Me.boxPct.Width = Me.boxWhole.Width * dblPct
DoEvents
'TVCodeTools ErrorHandlerStart
Proc_Exit:
Exit Sub
Proc_Err:
Select Case Err.Number
Case Else
Select Case ErrorDisplay(Err.Number, Error$, mcStrModule, "UpdateCurStep", Erl())
Case errContinue
Resume Next
Case errexit
Resume Proc_Exit
End Select
End Select
'TVCodeTools ErrorHandlerEnd
End Sub
Public Property Let NumSteps(pintStrEventFunction As Integer)
' Comments :
' Parameters:
' Created : 10/21/02 16:25 SMD
' Modified :
'
' --------------------------------------------------
'TVCodeTools ErrorEnablerStart
On Error GoTo Proc_Err
'TVCodeTools ErrorEnablerEnd
mintNumSteps = pintStrEventFunction
'TVCodeTools ErrorHandlerStart
Proc_Exit:
Exit Property
Proc_Err:
Select Case Err.Number
Case Else
Select Case ErrorDisplay(Err.Number, Error$, mcStrModule, "NumSteps", Erl())
Case errContinue
Resume Next
Case errexit
Resume Proc_Exit
End Select
End Select
'TVCodeTools ErrorHandlerEnd
End Property
Private Sub cmdGo_Click()
' Comments :
' Parameters: -
' Modified : 10/21/02 - 16:33
'
' --------------------------------------------------
'TVCodeTools ErrorEnablerStart
On Error GoTo Proc_Err
'TVCodeTools ErrorEnablerEnd
Dim inti As Integer
Dim dblPct As Double
Me.lblEscape.Visible = True
Me.lblAbort.Visible = False
Me.txtI.Visible = True
Me.txtPctComplete.Visible = True
Me.boxWhole.Visible = True
Me.boxPct.Visible = True
fInLoop = True
fExitLoop = False
Do Until inti > Me.txtNumIterations Or fExitLoop
dblPct = inti / Me.txtNumIterations
Me.txtPctComplete = dblPct
Me.boxPct.Width = Me.boxWhole.Width * dblPct
Me.txtI = inti
'If Me.txtI Mod 1 = 0 Then
DoEvents
'End If
inti = inti + 1
Loop
Me.lblEscape.Visible = False
fInLoop = False
'TVCodeTools ErrorHandlerStart
Proc_Exit:
Exit Sub
Proc_Err:
Select Case Err.Number
Case Else
Select Case ErrorDisplay(Err.Number, Error$, mcStrModule, "cmdGo_Click", Erl())
Case errContinue
Resume Next
Case errexit
Resume Proc_Exit
End Select
End Select
'TVCodeTools ErrorHandlerEnd
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If fInLoop And KeyAscii = 27 Then
fExitLoop = True
Me.lblAbort.Visible = True
End If
End Sub
Thanks. Sean.