Multiple copies of a page

J

James Martin

Hello,

I have a report which needs to print two identical copies of each page and
then a third largely-identical copy of some pages. What I have done is
create a sub-report and add it three times to the report. Then in the
Detail_Format event of the main report I make the third sub-report visible
or invisible, depending on how many copies of the page we need. This is all
working fine.

The trouble I'm having is that, for the pages where we need three copies,
the client wants certain fields on copy 3 to not be printed.

I realize that I could create a separate sub-report to be used for copy 3
and omit these fields from it. But this means remembering to update two
sub-reports anytime changes are made. I'd prefer to use the same sub-report
three times and have it hide those fields via code whenever it's the third
copy.

So, to recap, I have three sub-report controls on the parent report which
are all really the same sub-report. Is there some way from within the
sub-report to determine which of the three sub-report controls on the parent
it's in. That way I could show/hide the necessary controls based on whether
or not we're on copy 3.

Alternatively, is there a better way to accomplish what I'm trying to
accomplish?

Thanks in advance.

James
 
A

Allen Browne

James, an alternative approach would be to use a Cartesian Product to give
you 2 or 3 copies of each record. The record then prints multiple times as
needed, and you can do away with your subreports.

1. Create a table with just one field called (say) CountID, type Number.
Mark this field as primary key.
Save the table as tblCount.
Enter 3 records (the values 1, 2, and 3.)

2. Create a query that uses both your existing table and tblCount.
In the upper pane of table design, there should be no line joining the
tables. This gives you every possible combination, i.e. 3 copies of each
record in your other table. Save the query.

3. Create a report using this query. In the report's Sorting And Grouping
dialog, choose the CountID on the first row of the dialog. If desired, add a
Group Header on this field, and set the CountID Header's property so it
forces a new page before this section (so each copy prints on a separte
page.)

4. For the fields that should not print on the 3rd copy, change their
Control Source to an expression. For example, if you want to skip the City
field on the 3rd copy, set the Control Source to:
=IIf([CountID]=3, Null, [City])
To suppress the attached label as well, right-click it and Change To | Text
Box, and set its Control Source to:
=IIf([CountID]=3, Null, "City:")

You say you don't always need the 3rd copy? If you have a way to indicate
this in the critiera, you could add that criterion to your query. For
example if you have a field numeric named HowManyToPrint, in the query you
could type this into the Criteria row under the CountID field:
<= [HowManyToPrint]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top