print warning (not preview)

A

Adam Milligan

All-

I have a database with two almost identical reports. One for customers and
another for internal use. What is happening is that people are accidentally
printing and sending the internal copy to customers. I would like the
database to warn before the internal copy is printed. I thought the "on
print" event would do it, but that fires on the print preview as well. Is
there an event that fires only when the user actually prints the report?
Thanks.

Adam Milligan
 
F

fredg

All-

I have a database with two almost identical reports. One for customers and
another for internal use. What is happening is that people are accidentally
printing and sending the internal copy to customers. I would like the
database to warn before the internal copy is printed. I thought the "on
print" event would do it, but that fires on the print preview as well. Is
there an event that fires only when the user actually prints the report?
Thanks.

Adam Milligan

No there is no event that fires only if the report is printed, but
there is an event that fires only if the report is previewed.
So, you can display a message when the report is not previewed
(printed), or make the detail section, for example, not visible when
printed.

The actual starting value of intPreview depends upon if you have a
control in the report to compute [pages].

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 "You are about to print a report that you shouldn't."
End If
intPreview = intPreview + 1
End Sub

You can also alter the report when/if actually printed:
In the Detail Print event..
If intPreview >= 0 Then ' or >= 1 if [Pages] used.
Cancel = true ' Hide the Detail section if printed.
End If
 
Top