e...@nt wrote:
kalo dibuat 2 button gmn ?
button Preview & Print
flag cm ditaruh di button Print sj..
Thanks utk idenya, sy dapat jawaban dari forum luar mungkin bermanfaat
On a report already open in print preview mode, you wish to log the
print action only if the user has actually gone ahead with final OK in
print dialog box. If at any stage, the user cancels the print dialog
box, there should be no activation of print logging routine.
Considering the fact that report header's print event fires afresh for
each new print-out, your objective can be met by monitoring the print
event for report header from the second occurrence onwards.
Let F_Report be the name of calling form. Place an unbound text box
named TxtPreview on this form. Code in click event of command button
named CmdReport would be as follows:
' Code in form's module
'===========
=======================
Private Sub CmdReport_Click()
Me.TxtPreview = Null
DoCmd.OpenReport "<<NameOfMyReport>>", _
acViewPreview, , "MyCriteria"
DoCmd.Maximize
DoCmd.RunCommand acCmdZoom100
End Sub
'==================================
The code in print event of report header section would be as follows:
' Code in report's module
'==================================
Private Sub ReportHeader_Print(Cancel As Integer, _
PrintCount As Integer)
With Forms("F_Report")
If !TxtPreview = "Y" Then
CurrentDb.Execute "<<SQL_ForActionQuery>>", _
dbFailOnError
Else
!TxtPreview = "Y"
End If
End With
End Sub
'==================================
Note:
It is to be ensured that the height of report header section is not
zero. Otherwise, its print event won't fire.
---------------------------------------------------------------------------
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.