Try the following in the click event of a button on your form or in your
form's load event:
Dim rpt As New Report
Dim strReportName As String
Dim strPrinterName As String
* strReportName = [name of your Report here]
* strPrinterName = [name of your Printer here]
DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Reports(strReportName)
rpt.Visible = False
Set rpt.Printer = Printers(strPrinterName)
DoCmd.Close acReport, strReportName, acSaveYes
*[ ] enclose name of report/printer here (in quotes).
Mario said:
I entered this code in the on click property of a form and got this
message
after it highlighted the word "Public":
"Invalid Attribute in Sub or Function"
--