save a report to a pdf problems!

NewbieUK

Registered User.
Local time
Today, 11:24
Joined
Aug 17, 2010
Messages
29
Can anyone help?

I need to save a report to a PDF and am using the following code:

Private Sub Label16_Click()
DoCmd.OutputTo acOutputReport, "All Active Change Controls Report", acFormatPDF, ("Change Controls" & Format(Now(), "mmmyyyy") & ".pdf"), True
End Sub

I am getting an error saying acFormatPDF is not recognised. Do I need some kind of add in to allow this to work?

Thanks
 
Have you installed the OutputToPDF Addin?
 
No I haven't, I thought that might be it. but not sure where to get it from?
 
Do you know if it will work if I'm working with Access 2000?
 
hmmm, back to the drawing board then!! I need to able to export an access report to pdf so it can be distributed via email as and when needed. I have crystal reports which would do the trick, only problem is my end users will not!!

Thanks for your time today!
 
just one more questions!!

if the user has a pdf writer installed, by vba could the report be set to print and define the printer as the pdf writer?
 
Don't give up there is a solution here on the forum. Search For Allen Brownes Export to PDF solution.
 
Allen Browne? Sure you don't mean Stephen Lebans? :-)
http://www.lebans.com/reporttopdf.htm
It works well in a vast majority of cases.
(Indeed I've only had problems when using it to combine distinct PDFs.)

2007 did indeed require the Addin. 2010 - so lucky... right out of the box. lol
(Sarcasm much?)
 
I have found that attached bit of code which is working fine, apart from it opens the save as dialogue box even though the file name and location should be set in the code. Anyone know why this is happening?

Thanks
 

Attachments

Sorry, I've not really been involved - but do you have a PDF writing application installed on your users PCs? Acrobat professional of PDFWriter (as that code snippet seems to require) etc?
If not then you'll need something distributable. Stephen Lebans provides those in the shape of two DLLs you can download.

Cheers.
 
Yes I have the software installened and it all works fine. the file is being outout to a pdf but it asks me for a filename where i thought the code states the file name and file path to save it to.

I really need the function to save to a pdf without asking the user where to save it to and what name to give it.
 
Have you confirmed that the registry location ("Software\Adobe\PDF995") is being written to with the file name and path that you're passing to the code?

(And that the other registry locations exist - given your OS version.)
 
Just checked and it is being written. see attached pic.
 
sorry, its too big to attach but it is being written and the other registry entries are also there.
 
And since that PDF is produced, then the device is specified in
Software\Microsoft\Windows NT\CurrentVersion\Windows\Device as "PDF995"?

If the path and file name are correct and valid (i.e. you paste the exact same value property into the prompt dialog that opens and it works) then I don't know what the problem would be.
I recall having a brief dalliance with PDF995 years ago - just to try it, but have always used Stephen's PDF solution if it needs to be distributed with the application - which is does.

So does the exact same, copied and pasted, file path work when the prompt comes up?
 
when the save as dialogue box comes up, i can specifiy whatever filename I want and it saves no problems. But I had thought from the code that it was already specified where to save and the file name to give it.

I may have a look at the other option you supplied and see if I can get that one working instead. wish me luck!

Thanks for you help with this!! I'm on a schedule and need to get it working by tomorrow!

Thanks Again
 
It's impossible to say.
If you're sure the file path is correct and all specified in the registry correctly then there's nothing else to be done apparently (except researching on the PDF995 website for changes/updates since that code).

The Stephen Leban's option works fairly directly - and has plenty of example code.
(Import most of it - and just call the provided functions.)

Cheers.
 
i dont suppose you know already what changes i need to make to the code to adapt it to my report names, my file path and file name that i want to save as do you?
 

Users who are viewing this thread

Back
Top Bottom