Programatically renaming reports when printing to .pdf
Posted on 2005-05-11
I have an application designed to generate reports to .pdf and automatically e-mail them. I am using pdf995 as the PDf function which allows you to pass it the report name. When Access prints to the pdf driver it uses the Caption control as the Printed document name. As long as I preview the report first, I can set the caption to whatever i want in the OnOpen function and when I print it it creates the correctly named file. However, if I print directly without previewing it first, the default report name is used. As an example, I have a report called "Dist_Sales_Report". If I want just western distributors, I run the report as "Dist_Sales_Report-WEST" and set the Caption in the report as that. When I run it in preview, the report shows "Dist_Sales_Report-WEST" and when I print it the .pdf generated is the same. If I just print without previewing, the .pdf generated file is "Dist_Sales_Report". Any suggestions?