Copy Report not printing as PDF correctly (Access 2000)

  • Thread starter Thread starter KC via AccessMonster.com
  • Start date Start date
K

KC via AccessMonster.com

I have a report that I copy (CopyObject acReport) during Runtime so that I can rename it and print/save as PDF (via Distiller).

The report has references to sub-reports - and works fine when opening normally. However, when I try to send the 'copy' to print as PDF the fields that reference the sub-reports error out.

Does anyone know of a way to get this to work? Do I have to do something special after the copy command to get all of the references to work?

I have also tried just opening the report...and then printing as PDF manually...but the same problem with the "sub" references.

Thanks in advance for any suggestions.
 
My guess is that Access is getting confused here, and Name AutoCorrect is a
likely culprit. Uncheck the boxes under:
Tools | Options | General | Name Auto Correct
Then compact the database:
Tools | Database Utilities | Compact
and try again.

More info on the Name AutoCorrect problems:
http://members.iinet.net.au/~allenbrowne/bug-03.html

It's unusual to copy a report like that at runtime, but unless you copied
the subreport also (so it changed its name), it should work. Creating (and
then destroying?) reports constantly will bloat the database.

There are other possible causes, such as calculated fields being
misunderstood:
http://members.iinet.net.au/~allenbrowne/ser-45.html
or references in the subreport that refer to the main report by name.
 
Thanks for the info...yes the copy is only so that the report name can change so the PDF file will be Unique. What you state makes sense..since the main report is getting a new name...and the subforms have references to the old name. I am looking at how to change these references 'on the fly'...or reimplement the fields to remove the dependency.

I was wondering however, why you cannot change the name of the report when it is getting printed via Distiller...the Open() event does not execute in this case...

Thanks again...I will look at the links you mentioned...
 
Interesting. If you preview the report, you can set its Caption in
Report_Open, and then Acrobat uses the Caption as the default file name.

However, if you print directly, you are asked for the file name before
Report_Open. (The event does still fire, but too late for the Caption to be
modified.)
 
Back
Top