DoCmd.OutputTo Crashes Access 2007

  • Thread starter Thread starter Guy Bergeson
  • Start date Start date
G

Guy Bergeson

I am executing the following code:

Set myReport = Report_001WO_General

'build the filter string
strSql = "WorkOrderNumber = '" & WONum & "'"

'Get the temp directory path
strTempPath = GetWindowsPathNames.fReturnTempDir
strFileName = WONum & ".snp"
'strFileName = WONum & ".PDF"

strTempPath = strTempPath & strFileName
'Debug.Print strTempPath

'Open the report for viewing only
Set myReport = Report_001WO_General
'Set myReport = [Report_035Report-JT3DeliverySheet]

DoCmd.OpenReport myReport.name, acViewPreview, , strSql, _
acHidden, strSql
Reports(myReport.name).Visible = False
DoCmd.OutputTo acOutputReport, myReport.name, _
acFormatSNP, strTempPath & strFileName
'DoCmd.OutputTo acOutputReport, myReport.name, _
acFormatPDF, strTempPath, , , , acExportQualityPrint

saveSnapShotWO = strFileName

The report in question opens correctly. But the OutputTo command for either
PDF or SNP format crashes Access. I get that wonderful message: Access needs
to close, if you were doing something, sorry it's gone!

How can I troubleshoot this? How do I find out what is crashing Access. I
have substituted another, simpler report and it works. So I'm trying to
understans what about this report crashes the OutputTo command.

Also, this code worked in Access 2003, prior to the mandated update to
Access 2007.
 
Back
Top