I have several procedures in my program code that have more than one Loop events. For example:
'LOOP1
If Not rs.BOF Then
Frmprog.ProgressBar1.Max = cnt
Do While Not rs.EOF
intCounter = intCounter + 1
Frmprog.ProgressBar1.Value = intCounter ' Update progress.
ee_id = rs![Employee Id]
Call SingleProcess
If CancelRun Then Exit Sub
rs.MoveNext
Loop
Unload Frmprog
End If
'LOOP2
sqlquery = "select table1.*, table2.* from table1 inner join table2 on table1.employee_id=table1.[Employee Id] where table1.paydate=#" & USEnd_Date & "# and table1.company_id=" & Company_ID
Set rsVac = dbPayroll.OpenRecordset(sqlquery, dbOpenSnapshot)
If Not rsVac.BOF Then
rsVac.MoveFirst
While Not rsVac.EOF
Vac_id = rsVac!employee_id
CurrentPayNumber = PEDNumber(PayOpt)
If CurrentPayNumber = 0 Then
Exit Sub
End If
Call VacProcess
Loop
rsVac.MoveNext
Wend
End If
As you can see, loop 1 has the progress bar coming up, but loop 2 does not. How can I have the progress bar to appear and remain on screen for the execution of both loops without having to initialize the counter a second time?
Thanks
'LOOP1
If Not rs.BOF Then
Frmprog.ProgressBar1.Max = cnt
Do While Not rs.EOF
intCounter = intCounter + 1
Frmprog.ProgressBar1.Value = intCounter ' Update progress.
ee_id = rs![Employee Id]
Call SingleProcess
If CancelRun Then Exit Sub
rs.MoveNext
Loop
Unload Frmprog
End If
'LOOP2
sqlquery = "select table1.*, table2.* from table1 inner join table2 on table1.employee_id=table1.[Employee Id] where table1.paydate=#" & USEnd_Date & "# and table1.company_id=" & Company_ID
Set rsVac = dbPayroll.OpenRecordset(sqlquery, dbOpenSnapshot)
If Not rsVac.BOF Then
rsVac.MoveFirst
While Not rsVac.EOF
Vac_id = rsVac!employee_id
CurrentPayNumber = PEDNumber(PayOpt)
If CurrentPayNumber = 0 Then
Exit Sub
End If
Call VacProcess
Loop
rsVac.MoveNext
Wend
End If
As you can see, loop 1 has the progress bar coming up, but loop 2 does not. How can I have the progress bar to appear and remain on screen for the execution of both loops without having to initialize the counter a second time?
Thanks