Somebody help me !!!
I Have One Report that can be called from form (with Print & Print Preview Button). Before I Print that Report I want The Print Dialog Box appear. I Have try the way below but don't work.
Private Sub Report_Activate()
On Error GoTo Err_Report_Activate
Dim strMsg As String
Dim strTitle As String
strMsg = "There Were No Records Returned." & vbCrLf & "Print has been Cancelled."
strTitle = " No Records Returned"
If Me.Report.HasData Then
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, Me.Name
Else
MsgBox strMsg, vbInformation + vbOKOnly, strTitle
DoCmd.Close acReport, Me.Name
End If
Err_Report_Activate:
Resume Next
DoCmd.Close acReport, Me.Name
End Sub
My opinion, that code above not work because there are Print Preview Button. Is it correct ?? How to solve this problem ???
Thank's
I Have One Report that can be called from form (with Print & Print Preview Button). Before I Print that Report I want The Print Dialog Box appear. I Have try the way below but don't work.
Private Sub Report_Activate()
On Error GoTo Err_Report_Activate
Dim strMsg As String
Dim strTitle As String
strMsg = "There Were No Records Returned." & vbCrLf & "Print has been Cancelled."
strTitle = " No Records Returned"
If Me.Report.HasData Then
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, Me.Name
Else
MsgBox strMsg, vbInformation + vbOKOnly, strTitle
DoCmd.Close acReport, Me.Name
End If
Err_Report_Activate:
Resume Next
DoCmd.Close acReport, Me.Name
End Sub
My opinion, that code above not work because there are Print Preview Button. Is it correct ?? How to solve this problem ???
Thank's