Hi Guys,
I am working on a billing database. I have a report in which through VBA I am opening another report(PrintBill).
Using following VBA code:
Private Sub BillNumber_Click()
Forms!PrintBill!BillNum = Me.BillNumber
DoCmd.OpenReport "PrintBill", acViewReport, , "BillNumber = " & Me.BillNumber
DoCmd.SelectObject acReport, "PrintBill"
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "PrintBill", acSaveNo
End Sub
This works fine and open the print dialogbox, now there I need to change printer and press OK (Enter or Mouse click), I want to automate this action. I know we can set different printer and page settings for each report and through that the process could be made easy, but the issue is sometimes I use same report to print to default printer and sometimes to other printers (Like MS PDF or cute PDF or Nitro PDF, etc), hence I want the same to be done through the code. Also if we make default setting as required for the report still it needs to press OK (or Enter on keyboard ) I want to avoid that step also.
Further the report is going to be mostly sent to cutePDF printer, hence after every print command the dialog box asks to save file, also can i also automate it like pressing ENTER key Or SPACE key as required.
Thanks in advance for your help.
regards
Deepak Gupta