I am developing an Access 2007 "project" (.adp) as a front-end to data held in a SQL Server 2005 Express database.
Usually, I use the following VBA code to print a Report, giving the operator the Windows "Print" dialogue box to choose the printer they want to use.
DoCmd.OpenReport strReportName, acViewPreview, , , , strLongOpenArgs
DoCmd.Close acReport, strReportName
What I would like to do this time is immediately print to a particular printer (defaulted in the design of the Report) without requiring any further intervention by the operator.
I have tried various permutations of changing "acViewPreview" to "acViewNormal" and commenting out some of the other lines, but although I can sometimes get the report to print immediately, some odd things seem to happen in the "Report_Open" and "Report_Load" events of the Report.
Can someone put me right on this, and tell me the best way to get a Report immediately printed, with the "Report_Open" and "Report_Load" events fully obeyed?