Display Number Reports to be printed

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

Guest

Is their a way to read the number of pages that will print using a DoCmd?
I got a form that I use with some different fillers and than I will do a
DoCmd.OpenReport stDocName, acNormal
to print off a batch of reports. Before it starts printing I would like to
display the number of reports the printer is going to print to a message box
for a double check. Any ides?
 
In the report's 'On Page' event add:

If Me.Page = 1 then
MsgBox "This report contains " & Me.Pages
End If
 
Sorry Gus, I can see what you're asking. For completeness use (in the
report's 'On Page' event):

If Me.Page = 1 then
If MsgBox("This report contains " & Me.Pages & " pages." & vbCrLf &
vbCrLf & "Do you wish to continue?", vbYesNo, "Printing Report") = vbNo then
DoCmd.Close acReport, strDocName
Exit Sub
End If
End If
 
Hi Gus

The 'On Page' event is triggered before each report page is printed. As I've
written it, it will only throw up the message as Page 1 loads (but before its
printed) which, I think, is where you want it. Your option would prompt the
message box for each page in the report - that could be somewhat irritating
for big reports! However, if that is what you do want, then you don't need
that line at all (or the closing End If).

Good luck and please let me know how you get on.
 
Back
Top