acFormatPDF problems

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 05:04
Joined
Sep 12, 2006
Messages
15,983
OK - issues with outputting reports to pdf.


in A2003, I have used Stephen Lebans code, to output to a snapshot file, and then convert the snapshot to pdf, which has never let me down.

I am trying to use A2010 to do the same thing directly.

so this code fails every time

DoCmd.OutputTo acOutputReport, RptName, acformatpdf, documentpath

i tried a lot of things and finally found that replacing the constant with its text value also fails every time.
(although the constant acformatpdf DOES show "PDF Format (*.pdf)"

DoCmd.OutputTo acOutputReport, RptName, "PDF Format (*.pdf)", documentpath


i noticed that in Stephen Lebans code for snapshot he uses the definition ""SnapshotFormat(*.snp)"" (no spaces) and tried instead

DoCmd.OutputTo acOutputReport, RptName, "PDFFormat(*.pdf)", documentpath
which works most of the time, but occasionally fails. not sure if there are asynchronous timing issues at work?

Anyone know what is going on?


-----
the other thing is - the first way - snapshot, then pdf, always produces the correct fonts.
- using .outputto directly is not generating the fonts correctly either.



Has anyone seen these issues before?
 
Hi Paul,

Just checking your document path has .pdf at the end?

I use OutputTo quite a bit and never had a problem, but I also set the next parameter (autostart) to true or false as required.

Re fonts, again, not had a problem
 
Did you mean Dave.. :D

Well Dave as CJ has mentioned, I use acFormatPDF on Access 2010 and have not found any problem with it.. Is the Report Open when you are performing this operation? Is your FileName properly generated, adhering to Windows Naming conventions ?
 
Did you mean Dave..
biggrin.gif

I did:o - you lose the signature bit when you reply and I find all these alter egos confusing;)

Sorry Dave/Paul
 
i have posted this sort of question in a few places to try to get a resolution

anyway, i think it's sorted now. I think docmd.outputto was objecting to underscore characters in the file name. i replaced them with hyphens and the problems appear to have disappeared.
 
I thought Windows allow File/Folder name with underscores.. But if it does fix the problem that's good.. :)
 
yes, it does allow underscores.

i think underneath long file names, there is still a 8.3 structure going on, isn't there. maybe it's an issue with the way the lfn translates to 8.3 names.

the other thing -- occasionally when i try to folllow a hyperlink to open a pdf - i get a "are you sure" message - which I also thought might be an issue with the name


eg - a different thing. the first of these works normally. the second gives you a warning, and then opens.

Code:
Sub openpdfs()
 
    On Error Resume Next
    Application.FollowHyperlink "c:\somefile.pdf"
    On Error Resume Next
    Application.FollowHyperlink "c:/somefile.pdf"
End Sub
 
My file names never have hit the problem of SFN.. so I am helpless there..

BUT.. When I used the code, I observed that the Forward slash forces the PDF to be opened in IE, but back slash opens the document in normal PDF viewer.. Maybe Access identifies opening webpages a security concern?
 

Users who are viewing this thread

Back
Top Bottom