Detect Printing

  • Thread starter Thread starter Stefan Wetter
  • Start date Start date
S

Stefan Wetter

Hello!

I want to update some data when a report has been printed. How can i
detect, if a report has been printed and not only viewed? I have no
idea. Controlling the printer could do that, but is there a more easy
possibility?
I am using Access2K.

Thanks!
Stefan
 
Hello!

I want to update some data when a report has been printed. How can i
detect, if a report has been printed and not only viewed? I have no
idea. Controlling the printer could do that, but is there a more easy
possibility?
I am using Access2K.

Thanks!
Stefan

You can use the below method to determine if the report has been sent
to the printer, either after preview or without preview. However,
other than actually having the actual paper report in your hand, there
is no way to determine if the report was 'successfully' printed.
Printers run out of paper, ink, get turned off, drivers get corrupted,
etc.

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 "Gone Printing"
End If
intPreview = intPreview + 1
End Sub

To do something only when the report is printed, you can code, for
example, the Detail Print event..
If intPreview = 0 Then
' Do something here
End If
 
Back
Top