[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Visual Basic:  acOutputReport Results in Error 2302:  Microsoft Access can't save the output data to the file you've selected.

Posted on 2013-11-08
14
Medium Priority
?
3,668 Views
1 Endorsement
Last Modified: 2014-01-03
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:

appAccess.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, "My Report", _
  "PDF Format (*.pdf)", "C:\" & gstrDateStamp & " My Report.pdf", True, "", , _
  Access.AcExportQuality.acExportQualityPrint)

Open in new window

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
1
Comment
Question by:mjs082969
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +2
14 Comments
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39633625
The application may not have the necessary permission to write to:
"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
0
 

Author Comment

by:mjs082969
ID: 39633771
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(Access.AcOutputObjectType.acOutputReport, "MyReport", Access.Constants.acFormatTXT, "C:\" & gstrDateStamp & " MyReport.txt", True, "", , Access.AcExportQuality.acExportQualityPrint)

appAccess.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, "MyReport", Access.Constants.acFormatSNP, "C:\" & gstrDateStamp & " MyReport.snp", True, "", , Access.AcExportQuality.acExportQualityPrint)
 
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
0
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 39633790
OK. Some progress.

First check if at all Access can save to PDF on that machine.
You are correct that the XI reader can be an issue. It's a monster.

Try building the path:

strPath = Chr(34) & "C:\" & gstrDateStamp & " My Report.pdf" & Chr(34)

Then:

appAccess.DoCmd.OutputTo(Access.AcOutputObjectType.acOutputReport, "My Report", "PDF Format (*.pdf)", strPath, True, "", , Access.AcExportQuality.acExportQualityPrint)

/gustav
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mjs082969
ID: 39634759
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!
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39634858
You are welcome!

/gustav
0
 

Author Comment

by:mjs082969
ID: 39645979
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.InteropServices.COMException' occurred in MyProgram.Exe

Regardless of what format I use.  

Any advice would be greatly appreciated!

Thanks Again,

- Michael
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39651072
Try this (works for me with the environment you described):

docmd.OutputTo acOutputReport, "myReport", acformatpdf,,true

Open in new window


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

Open in new window


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

Open in new window



3.
Dim strFile as string
strFile =  "C:\" & gstrDateStamp & "MyReport.pdf" 


docmd.OutputTo acOutputReport, "myReport", acformatpdf, strFile ,true, "", , Access.AcExportQuality.acExportQualityPrint '<-- add the print quality

Open in new window

0
 
LVL 15

Expert Comment

by:dbbishop
ID: 39651538
Did you try mbizup suggestions?
0
 
LVL 15

Expert Comment

by:dbbishop
ID: 39651560
try replacing "PDF Format (*.pdf)" with Access.acFormatPDF
0
 

Author Comment

by:mjs082969
ID: 39674890
I will attempt the suggestions...
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39734469
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 

Author Comment

by:mjs082969
ID: 39754437
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question