mjs082969
asked on
Visual Basic: acOutputReport Results in Error 2302: Microsoft Access can't save the output data to the file you've selected.
I trying to save an Access 2013 report as an Adobe Acrobat document. When the application is run on my system, I do not receive an error. When this is run on the system where the application is scheduled to run, the following error is received:
"Error #2302: Microsoft Access can't save the output data to the file you've selected."
This is my statement:
- Creating an empty file and naming it what the Acrobat file will be named, so the file already exists.
- Set the autostart parameter to True or False
Any ideas you might have would be greatly appreciated!
Thanks In Advance,
- Michael
"Error #2302: Microsoft Access can't save the output data to the file you've selected."
This is my statement:
appAccess.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, "My Report", _
"PDF Format (*.pdf)", "C:\" & gstrDateStamp & " My Report.pdf", True, "", , _
Access.AcExportQuality.acExportQualityPrint)
I have tried several things, which do not seem to have any impact:- Creating an empty file and naming it what the Acrobat file will be named, so the file already exists.
- Set the autostart parameter to True or False
Any ideas you might have would be greatly appreciated!
Thanks In Advance,
- Michael
ASKER
I'm desperate. If you tell me that making and wearing a helmet out of Jell-o will fix it, I'm in...
I did try the following statements, and they execute successfully.
appAccess.DoCmd.OutputTo(A ccess.AcOu tputObject Type.acOut putReport, "MyReport", Access.Constants.acFormatT XT, "C:\" & gstrDateStamp & " MyReport.txt", True, "", , Access.AcExportQuality.acE xportQuali tyPrint)
appAccess.DoCmd.OutputTo(A ccess.AcOu tputObject Type.acOut putReport, "MyReport", Access.Constants.acFormatS NP, "C:\" & gstrDateStamp & " MyReport.snp", True, "", , Access.AcExportQuality.acE xportQuali tyPrint)
They aren't what I need, but they are very similar. And, again, they are executing successfully...
So that probably rules out a problem with permissions.
I have determined that on the machine where it is successful, I have Adobe Acrobat Pro 9 installed. On the system where it is failing, I have Adobe Reader XI installed. Hmmmm...
But I will try removing the spaces from the report name and see if that has any impact...
Thanks Again,
- Michael
I did try the following statements, and they execute successfully.
appAccess.DoCmd.OutputTo(A
appAccess.DoCmd.OutputTo(A
They aren't what I need, but they are very similar. And, again, they are executing successfully...
So that probably rules out a problem with permissions.
I have determined that on the machine where it is successful, I have Adobe Acrobat Pro 9 installed. On the system where it is failing, I have Adobe Reader XI installed. Hmmmm...
But I will try removing the spaces from the report name and see if that has any impact...
Thanks Again,
- Michael
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think the different versions of Adobe ARE causing a nightmare!
I am going to ask the user if they can handle XPS... but they are gone for the weekend. I will close this off on Monday.
Have a Great Weekend and thanks for the assistance!
I am going to ask the user if they can handle XPS... but they are gone for the weekend. I will close this off on Monday.
Have a Great Weekend and thanks for the assistance!
You are welcome!
/gustav
/gustav
ASKER
This must be something to do with the system environment. It will work on some systems, but not others. On the ones where it continues to fail I receive the following error:
A first chance exception of type 'System.Runtime.InteropSer vices.COME xception' occurred in MyProgram.Exe
Regardless of what format I use.
Any advice would be greatly appreciated!
Thanks Again,
- Michael
A first chance exception of type 'System.Runtime.InteropSer
Regardless of what format I use.
Any advice would be greatly appreciated!
Thanks Again,
- Michael
Try this (works for me with the environment you described):
If it works, try building on it successively to isolate the problem:
1.
2.
3.
docmd.OutputTo acOutputReport, "myReport", acformatpdf,,true
If it works, try building on it successively to isolate the problem:
1.
Dim strFile as string
strFile = "myreport.PDF" '<--- uses same folder as the database
docmd.OutputTo acOutputReport, "myReport", acformatpdf, strFile ,true
2.
Dim strFile as string
'****** Check this... the file is being placed at the root level on the C drive. Should it be under a folder specified by gstrDateStamp?
strFile = "C:\" & gstrDateStamp & "MyReport.pdf" '<---- Use full path
docmd.OutputTo acOutputReport, "myReport", acformatpdf, strFile ,true
3.
Dim strFile as string
strFile = "C:\" & gstrDateStamp & "MyReport.pdf"
docmd.OutputTo acOutputReport, "myReport", acformatpdf, strFile ,true, "", , Access.AcExportQuality.acExportQualityPrint '<-- add the print quality
Did you try mbizup suggestions?
try replacing "PDF Format (*.pdf)" with Access.acFormatPDF
ASKER
I will attempt the suggestions...
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
ASKER
I was not able to resolve the issue with any of the feedback given. I elected to migrate the reports out of Microsoft Access and into another source.
"C:\" & gstrDateStamp & " My Report.pdf"
Or try using a path without spaces:
"C:\" & gstrDateStamp & "MyReport.pdf"
Or, if that works, wrap the full path in quoutes, Chr(34).
/gustav