Access Progress Meter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a command button used to print a large number of records
(up to 900 though the total varies). Each record in the recordset contains up
to 35 thumbnail images so the process is very slow!
As each page is part of the same report, can I use a progress bar with this
process?
I can easily count the number of records in the recordset to indicate the
total number of iterations. The idea would be that as each page goes to the
printer, this will increment the progress bar. Will it work?
 
ridders said:
I have a form with a command button used to print a large number of records
(up to 900 though the total varies). Each record in the recordset contains
up
to 35 thumbnail images so the process is very slow!
As each page is part of the same report, can I use a progress bar with
this
process?
I can easily count the number of records in the recordset to indicate the
total number of iterations. The idea would be that as each page goes to
the
printer, this will increment the progress bar. Will it work?

Should work fine. Have a look at the following KB article:

http://support.microsoft.com/kb/103404/en-us
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Hi Arvin

Thanks for the reply. Partial success!
If I print one record this works fine.
If I try to do 2 records, it prints 4 (2x2) ; 3 records gives 9 etc!

Obviously I have wrongly placed my two loop statements but can't see how to
fix it. Code shown below. Any thoughts?

Thanks
-----------------------------------------------------------------------------
Private Sub btnPrintPhotos_Click()
On Error GoTo Err_btnPrintPhotos_Click

'Bulk print class photos after warning user that
'printing many classes may take a long time

If Me.LstClasses.ItemsSelected.Count = 0 Then
MsgBox "You have not selected a set to print"
Exit Sub
End If

If Me.LstClasses.ItemsSelected.Count > 10 Then
Dim Msg, Style, Title, response, MyString

Msg = "Printing many sets of photos at once may take a long time" &
vbNewLine & _
"Are you sure you want to continue?" & vbNewLine & vbNewLine & _
"Click YES to continue printing these classes" & vbNewLine & _
"Click NO to return to the list of classes"

Style = vbYesNo + vbInformation + vbDefaultButton2 ' Define buttons.
Title = "WARNING" ' Define title.
response = MsgBox(Msg, Style, Title)
'If user chooses No, return to selection box.
If response = vbNo Then Exit Sub
'If user chooses Yes, continue printing
End If

'Continue printing if Me.LstClasses.ItemsSelected.Count is between 1 And 10

'Show progress meter
Dim Counter As Integer
SysCmd acSysCmdInitMeter, "Printing class photos: ", Me.txtTotalClass
For Counter = 1 To Me.txtTotalClass
SysCmd acSysCmdUpdateMeter, Counter

Dim ctl As Control
Dim varItm As Variant
Set ctl = Forms!PrintClassPhotos.LstClasses
stDocName = "rptClassPhotos"
For Each varItm In ctl.ItemsSelected
strClass = ctl.ItemData(varItm)
If Me.ChkPreview = True Then
DoCmd.OpenReport stDocName, acViewPreview, , "ClassID = '" &
strClass & "'"
Else
DoCmd.OpenReport stDocName, acViewNormal, , "ClassID = '" &
strClass & "'"
End If

Next varItm

Next Counter

'Remove progress meter
SysCmd acSysCmdRemoveMeter

Me.LstClasses.Requery
Me.txtTotalClass = 0

'Re-sort LstClasses by TeacherID
Dim sort As Integer
sort = basOrderby("TeacherID", "asc")

Exit Sub

Exit_btnPrintPhotos_Click:
Exit Sub

Err_btnPrintPhotos_Click:
MsgBox err.Description
Resume Exit_btnPrintPhotos_Click

End Sub
 
Hi Arvin,

I realised the loops were 'nested' & have since fixed this.
Have since written my own code to make a larger progress bar with % complete
displayed as the procedure runs.

Thanks anyway
 
Back
Top