How do I print specific report with PrintObject in Macro

abzalali

Registered User.
Local time
Today, 11:03
Joined
Dec 12, 2012
Messages
118
Dear Expert,
Actually I need to select printer before printing report. That's why I need to call printer dialog to select printer using "PrintObject" in macro. But it's print the form not report. I need to print a specific report. How can I do this?

Please help me.

Thanks
Mir
 
It is now working with this code:
Code:
On Error GoTo CmdPrint_Click_Error
        DoCmd.OpenReport "rptECN", acViewPreview, , , acHidden
        DoCmd.SelectObject acReport, "rptECN"
        DoCmd.RunCommand acCmdPrint
        DoCmd.Close acReport, "rptECN"
    Exit Sub
CmdPrint_Click_Error:
          DoCmd.Close acReport, "rptECN"
          If Err.Number = 2501 Then
            Err.Clear
          Else
            MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
          End If

But report window comes behind printer dialog as new tab
How do I hide this window? Please help me.
 

Users who are viewing this thread

Back
Top Bottom