How do I know that a report preview was print?

G

Guest

How do I know that a report preview was print?
I need to register how many times a record is printed, I don’t have problems
if the report is open as normal but if it is open as preview how can I be
sure that it was print or not?

Thanks,
Tyan
 
F

fredg

How do I know that a report preview was print?
I need to register how many times a record is printed, I don¢t have problems
if the report is open as normal but if it is open as preview how can I be
sure that it was print or not?

Thanks,
Tyan

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

The above message will let you know whenever the report is printed,
both with or without preview.

You can keep track of the number of times it's actually printed by
creating up a table with one field and one record.
Set the first record value to 0 (Zero).
Then change
MsgBox "Printing" to:

CurrentDb.Execute "Update TableName Set TableName.CountPrinted =
TableName.CountPrinted + 1;", dbFailOnError
 

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