G
Guest
I have found what appears to be a bug in the Save as PDF/XPS add-in for
Access 2007.
Given a scenario where VBScript in a database containing a report calls code
in another database (via a reference) in order to generate report output in
either PDF or XPS format, the called code generates the following error upon
attempting the DoCmd.OutputTo method:
Run-time error '2509':
Microsoft Office Access cannot find the object 'reportname'
I have no problem outputting to other file types, such as TXT or RTF, nor do
I have any problem generating XPS or PDF output from code in the database
containing the report.
For instance, given the following two functions, contained in a referenced
database (used as a common function library):
Public Function testRTF(rName As String, destFile As String)
DoCmd.OutputTo acOutputReport, rName, acFormatRTF, destFile
End Function
Public Function testPDF(rName As String, destFile As String)
DoCmd.OutputTo acOutputReport, rName, acFormatPDF, destFile
End Function
The first function succeeds when called from the database containing the
report, but the second one fails with the aforementioned error. There is not
problem, however, executing a DoCmd.OutputTo to PDF format from code actually
contained in the same database as the report.
Can anyone else confirm this and suggest a workaround?!
I have confirmed this problem on two vastly different installations (one
Vista, one Windows 2003).
Access 2007.
Given a scenario where VBScript in a database containing a report calls code
in another database (via a reference) in order to generate report output in
either PDF or XPS format, the called code generates the following error upon
attempting the DoCmd.OutputTo method:
Run-time error '2509':
Microsoft Office Access cannot find the object 'reportname'
I have no problem outputting to other file types, such as TXT or RTF, nor do
I have any problem generating XPS or PDF output from code in the database
containing the report.
For instance, given the following two functions, contained in a referenced
database (used as a common function library):
Public Function testRTF(rName As String, destFile As String)
DoCmd.OutputTo acOutputReport, rName, acFormatRTF, destFile
End Function
Public Function testPDF(rName As String, destFile As String)
DoCmd.OutputTo acOutputReport, rName, acFormatPDF, destFile
End Function
The first function succeeds when called from the database containing the
report, but the second one fails with the aforementioned error. There is not
problem, however, executing a DoCmd.OutputTo to PDF format from code actually
contained in the same database as the report.
Can anyone else confirm this and suggest a workaround?!
I have confirmed this problem on two vastly different installations (one
Vista, one Windows 2003).