Greg Casper said:
I have a report which is called by a button on a form. This report,
rather than printing, creates a PDF file by specifying a specific
printer in the page setup for the report and using Acrobat PDFWriter
as the printer. I want to be able to change the name of the report
dynamically, rather than each instance saving as the report name. How
can I do this?
I could be wrong, but I don't think it's possible to change the *name*
of a report as you print it. You could change its Caption property, if
that should happen to be what the print driver is looking at. I don't
suppose the PDFWriter provides a means to specify the output file name
on the fly? I'd think that would be a good feature to have.
I can only think of two methods to work around this problem, if there's
no way to override the operation of the print driver.
1. Print the report to create the file, and then, as soon as the file
has been created, rename it in code using the Name statement. There may
or may not be a trick to identifying when the PDFWriter is done with the
file so that you can rename it.
2. Change the name of the report object, using DoCmd.Rename or some such
method, immediately before printing it. <Shudder!> This is a lousy
alternative. Even making a copy of the report object with the name you
want, and then printing that, is a very bad option.
Of these two alternatives, I'd certainly go with the first, given a
choice. But best would be to find a way to tell the PDFWriter what name
to use.