i have both Access 2007 and 2003 but I'm most interested in the 2003 version. Is there a way not to install dll just using code? (I've got a pdf printer, I don't need to directly convert reports to pdf)
I am not sure what you mean. If you edit the report's Page Setup, you can have the report print to the PDF printer all of the time.
An option that I am currently using is RunReportAsPDF. You can search for it on the Internet. You can add the code to a module in Access and it will print an Access report to a PDF. The reason I am using it is I needed to be able to specify a filename without prompting for it. The code edits a couple of registry settings to store the filename. Then Adobe creates the PDF. I don't think the code works with anything other than Adobe.
Are you using Adobe? The only way I know of to specify a filename is by setting the registry setting. Adobe checks the setting to see if it has been defined. If so, it uses that for the filename. Otherwise it prompts for the filename. It also resets the registry setting if a filename was saved there. So that the filename is only used once. You have to resave the filename if you want to create a new PDF with the same filename.
I found a solution by setting the printer
I save files on desktop, without having to do with boring prompts!
It is not the best, but I had not to modify register settings.
thank you for all your advice!
I have been playing around trying to get the same thing working, I'm not sure if 2003 has this same capabilities but you can copy and paste the code and see what happens.
Private Sub Command30_Click()
DoCmd.OpenReport "rptCoatedPartCache", acViewPreview
DoCmd.OutputTo acOutputReport, "rptCoatedPartCache", acFormatPDF, _
"U:\POBushingsAndPins\" & "PurchaseOrder" & [PurchaseOrder#] & ".pdf", False
This will open the report rptCoatedPartCache in print preview mode and outputs the file in .pdf format to the location on our shared company drive U:\ to the folder POBushingsAndPins and names the file PurchaseOrderXXXX.pdf, with the XXXX being the purchase order number from the report. It will dynamically name the file whatever field you choose from the database. This doesnt use the Print to PDF feature added in by adobe, it uses the output to pdf built into Access 2007, if 2003 doesn't have this maybe you can install it.
Hope this helps