Capture Print Event from a Report Preview

G

Greg

When a user chooses to Preview a report and the report is displayed on the
screen, how can I capture the Print Event. In other words, I want to know if
the user chooses to print the report while the report is displayed on the
screen in preview mode.

We need to know everytime a user chooses to print a report. Also, I know I
can take away the ability to print a previewed report, but I do not want to
take that feature away from the user.

Thanks.
 
F

fredg

When a user chooses to Preview a report and the report is displayed on the
screen, how can I capture the Print Event. In other words, I want to know if
the user chooses to print the report while the report is displayed on the
screen in preview mode.

We need to know everytime a user chooses to print a report. Also, I know I
can take away the ability to print a previewed report, but I do not want to
take that feature away from the user.

Thanks.

You can use the following code to determine if the report has been
sent to the printer, whether or not it has also been previewed.

HOWEVER... Even if it has been sent to the printer, there is no way to
tell if the printout has been successfully printed until you have the
paper report in your hand.

The actual starting value of intPreview below depends upon if you have
a control in the report to compute [pages].
Comment out the un-needed portion of the code accordingly.

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' If [Pages] is not used
' intPreview = -2 ' If [Pages] used
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
If intPreview >= 0 Then ' If [Pages] not used
' If intPreview >= 1 Then ' If [Pages] used
MsgBox "Gone Printing"
End If
intPreview = intPreview + 1
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top