DoCmd.OutputTo Crashes Access 2007

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top