[AccessD] Change Reports Caption From Code

Josh McFarlane darsant at gmail.com
Tue Jul 12 17:52:48 CDT 2005


On 7/12/05, Bob Heygood <bheygood at abestsystems.com> wrote:
> Thanks to all who responded. The on open event is what I used.
> I thot of it earlier, but thot twice about using a global variable.
> Not to start another rant/discussion, but I feel this is a good example a
> good use of a global.
> 
> I am creating 79 PDFs from code, which involves opening a report. The neat
> news is that the reports caption property is what Acrobat uses for the
> resulting file name. Hence my need to change the caption each time I
> programmically open the report.
> 
> 
> thanks again.
> 
> bob

You may wish to consider using OpenArgs. When calling the report via
code, you can pass it arguments via the DoCmd.OpenReport, then with
the OnOpen code, change the caption of the current report. I do this
with an form that I use to determine date range (changes form caption
to be the name of the report it is called to open) and it works like a
charm.

DoCmd.OpenReport ReportTest, acPreview,,,,"Report Caption"

Then in the on open handler:
Caption = OpenArgs

or something similar to fit your needs.
-- 
HTH
Josh McFarlane
"Peace cannot be kept by force. It can only be achieved by understanding."
-Albert Einstein



More information about the AccessD mailing list