Which event to display "Report printed" message?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

MS Access 2K, Windows XP
====================
Hi,

I'm printing a report by clicking on a button on a form.
I'd like to display a confirmation message using MsgBox that the report has
been printed.
I'm unable to figure out the form event to place this message.

Also, which error number would indicate a failed print?

I tried after the Docmd.... line in the OnClick event, but the message is
not displayed.

Any suggestions?

Thanks.

-Amit
 
MS Access 2K, Windows XP
====================
Hi,

I'm printing a report by clicking on a button on a form.
I'd like to display a confirmation message using MsgBox that the report has
been printed.
I'm unable to figure out the form event to place this message.

Also, which error number would indicate a failed print?

I tried after the Docmd.... line in the OnClick event, but the message is
not displayed.

Any suggestions?

Thanks.

-Amit

The following code will give you a message if the report has been sent
to the printer (as opposed to just being Previewed).
HOWEVER... there is no way to guaranty (using Access) that the report
has been in fact successfully printed, short of having the full report
in your hand. Printers do run out of ink, paper, etc., and fail to
finish the job.

Place the following code in the REPORT (not the Form).
Use the appropriate value, depending upon whether or not your report
is using a control to calculate [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 "Report is being printed"
End If
intPreview = intPreview + 1
End Sub
 
The following code will give you a message if the report has been sent
to the printer (as opposed to just being Previewed).
HOWEVER... there is no way to guaranty (using Access) that the report
has been in fact successfully printed, short of having the full report
in your hand. Printers do run out of ink, paper, etc., and fail to
finish the job.

Place the following code in the REPORT (not the Form).
Use the appropriate value, depending upon whether or not your report
is using a control to calculate [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 "Report is being printed"
End If
intPreview = intPreview + 1
End Sub
--

Hi Fred,

Thanks for your help. That is exactly what I was looking for, and it worked
for me.

Cheers,

-Amit
 
Back
Top