Tram Pham
asked on
Access 2013 VBA DoCmd.OutputTo failed to create PDF, but the same code works in Access 2010
I have this Access 2010 VBA code that works on computer with Access 2010, but got error on computer with Access 2013 or 2016:
"Run-time error '2282':
The format in which you are attempting to output the current object is not available"
If I replace acFormatPDF with acFormatRTF then it works on all versions of Access. But I do need PDF format.
Also, the Intellisense doesn't List Properties/Methods for OutputFormat parameter (on Access 2013 and Access 2016 computers).
Do you know what causes it and how to resolve this error?
Thank you.
DoCmd.OpenReport "rptArchiveRequest", acViewPreview
DoCmd.OutputTo acOutputReport, "rptArchiveRequest", acFormatPDF, "C:\ArchiveRequest.pdf", False
The error reads:"Run-time error '2282':
The format in which you are attempting to output the current object is not available"
If I replace acFormatPDF with acFormatRTF then it works on all versions of Access. But I do need PDF format.
Also, the Intellisense doesn't List Properties/Methods for OutputFormat parameter (on Access 2013 and Access 2016 computers).
Do you know what causes it and how to resolve this error?
Thank you.
ASKER
Hi Crystal,
Thank you so much for replying! The problem happens on 2 computers - 1 is user computer with MS Office 2013 (not new) and Acrobat Distiller, 1 is a test VM with MS Office 2016 and Acrobat Pro. I have verified that they both can read and create PDF files.
Am I the only one to have this problem, since I can't find any similar problem/question searching online? I've seen similar error with earlier version of Office (before 2007)
I would appreciate any tip or suggestion to troubleshoot this problem.
Thank you so much for replying! The problem happens on 2 computers - 1 is user computer with MS Office 2013 (not new) and Acrobat Distiller, 1 is a test VM with MS Office 2016 and Acrobat Pro. I have verified that they both can read and create PDF files.
Am I the only one to have this problem, since I can't find any similar problem/question searching online? I've seen similar error with earlier version of Office (before 2007)
I would appreciate any tip or suggestion to troubleshoot this problem.
if you double-click on a PDF file in Windows Explorer or My Computer, does it open? If so, what if you also put a PDF reader on those machines?
ASKER
I double-clicked a PDF file on the VM with Office 2016 -> it was opened in Acrobat Pro. I then installed the Acrobat Reader, and double-clicked to open the file again. This time, it was opened in Acrobat Reader.
The user computer that I have problem with, has Office 2013 and both Acrobat Reader and Acrobat Pro. When he double-clicked a PDF file, it was opened in Acrobat Pro.
The user computer that I have problem with, has Office 2013 and both Acrobat Reader and Acrobat Pro. When he double-clicked a PDF file, it was opened in Acrobat Pro.
hi Tram,
> "The user computer that I have problem with, has Office 2013 and both Acrobat Reader and Acrobat Pro. When he double-clicked a PDF file, it was opened in Acrobat Pro."
Change the default application associated with PDF:
have that user right-click a PDF file in Windows Explorer or My Computer and choose --> Open With
if Reader is not on the short list, then click 'Choose another app' from the bottom and pick Adobe Reader. AND check: 'Always use this app to open PDF files"
The reason it probably worked for the first case* is that Acrobat Reader was more recently installed and took over the file extension as the default.
* did that enable Access to work right for OutPutTo also?
have an awesome day,
crystal
> "The user computer that I have problem with, has Office 2013 and both Acrobat Reader and Acrobat Pro. When he double-clicked a PDF file, it was opened in Acrobat Pro."
Change the default application associated with PDF:
have that user right-click a PDF file in Windows Explorer or My Computer and choose --> Open With
if Reader is not on the short list, then click 'Choose another app' from the bottom and pick Adobe Reader. AND check: 'Always use this app to open PDF files"
The reason it probably worked for the first case* is that Acrobat Reader was more recently installed and took over the file extension as the default.
* did that enable Access to work right for OutPutTo also?
have an awesome day,
crystal
ASKER
Hi Crystal,
Thank you for being with me on this. To clarify the situation, both cases above - Office 2013 with default Acrobat Reader and Office 2016 with default Acrobat Pro - fail at OutputTo command code. It only works on Office 2010 computer, with either Acrobat Pro or Acrobat Reader alone.
Thank you for being with me on this. To clarify the situation, both cases above - Office 2013 with default Acrobat Reader and Office 2016 with default Acrobat Pro - fail at OutputTo command code. It only works on Office 2010 computer, with either Acrobat Pro or Acrobat Reader alone.
hi Tram,
on the computer with both Pro and Reader where it does not work, what is the default application for Windows for PDF files? I do not know if this makes a difference ... only guessing. since when Reader is installed last, it seems to work ok?
have an awesome day,
crystal
on the computer with both Pro and Reader where it does not work, what is the default application for Windows for PDF files? I do not know if this makes a difference ... only guessing. since when Reader is installed last, it seems to work ok?
have an awesome day,
crystal
ASKER
Crystal,
Office 2010 is the current Office version for the whole company. Some computers have Acrobat Pro, some have Acrobat Reader, on which the program runs fine. A few people are using Office 2013 (as needed for their work), and we are testing Office 2016 to prepare for company wide upgrade. In these 2 cases, either they have Acrobat Reader or Acrobat Pro or both, the program fails. So, I am pretty sure it is the version of Office/Access that causes the failure. But I don't know why or what is missing.
Office 2010 is the current Office version for the whole company. Some computers have Acrobat Pro, some have Acrobat Reader, on which the program runs fine. A few people are using Office 2013 (as needed for their work), and we are testing Office 2016 to prepare for company wide upgrade. In these 2 cases, either they have Acrobat Reader or Acrobat Pro or both, the program fails. So, I am pretty sure it is the version of Office/Access that causes the failure. But I don't know why or what is missing.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you're welcome, Tram ~ happy to help
ASKER
Following Crystal's suggestion, I encountered another issue. In search for this issue's solution, I found the explanation to my original issue. Just explanation, not solution, because what I want to do can't be done anymore, due to Adobe dropping its support for the newer Access versions.
when the problem happens, it is on a computer with an installation (new?) that perhaps does not have any program to render PDF?
to test:
in Windows Explorer or My Computer:
double-click on a PDF file from that computer ... does it open? if so, how? if not, what happens?
The first step to fix is to make sure the file type is recognized and can open properly
have an awesome day,
crystal