Use report Activate and Deactivate events to detect Preview Mode.
Activate/Deactivate doesn't happen in Print Mode.
There 's also way to detect Print from Preview. MS Knowledge Base article Q154894 describes it, but example there is wrong! Here is my version:
Dim Printing As Integer
' Use global if you want to test from subreport
Private Sub Report_Activate()
Printing = -1
End Sub
Private Sub Report_Deactivate()
Printing = 0
End Sub
Private Sub ReportHeader_Print(Cancel As Integer, _
PrintCount As Integer)
Printing = Printing + 1
End Sub
Private Sub Report_Close()
If Printing >= 1 Then
' This only works if report was printed, including print from
' preview!
End If
End Sub