Print Multiple Copies of Reports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables that are linked together by primary Key, (Detail Driver and
Summary Driver Records), Each record type has Driver Name, Owner Name and
Interested Party Name for EACH record type. There may or may not be Summary
Records for a Detail record, (1 Car accidents).
Issue is this. For every Different Name listed on corresponding Detail
Record and summary Record, I need to print a copy of the report, as well as
mailing labels and envelopes. I have used OpenReport and PrintOut Actions
and they work well when you hard code the number of copies, BUT.... I need
to be able to have a counter, that is zeroed on each change of detail record,
add 1 to the counter for each different name found on the detail record (up
to 3) and then add 1 to the same counter for each summary record name (up to
3 per summary record), so therefore you could have an unlimited number of
copies to print.

Can anyone advise the best way to do this. Like I say, I can make it work
if I hard code COPIES= on the PrintOut Action command. Is there any other
way.... PrintOut COPIES only accepts an integer and not a variable.

Would like some extra thought support here.


Thanks in advance
 
You can use a variable if you use the PrintOut method in code, rather than
the PrintOut action in a macro, e.g.:
Dim lngHowMany As Long
lngHowMany = 99
DoCmd.PrintOut Copies:=lngHowMany


There may be a better solution though, where you can print a copy with the
person's name on it.

1. Open the query for the report in design view.

2. Add the Driver table to the query a second time.
Access will add a suffix to the table name, calling it "Driver_1", so you
can distinguish it from the original one.

3. If you see any lines joining this to other tables, delete those lines.
It is the lack of any join that gives you a copy for each person.

4. Drag the primary key field from Driver_1 into the grid. In the Field row,
type this in front of the name of your primary key field:
CopyForID:
This gives the field an alias we can use in the report.

5. In the Criteria under this field, add anything you need to restrict the
number of records in this query.

6. Drag the name field into the grid also, if you wish to use that on the
report.
Alias this as CopyForName.

7. Save the query. Close.

8. Open the report in design view.

9. Open the Sorting And Grouping dialog (View menu).

10. On the first line of the dialog (insert a line if you need to), choose
the field:
CopyForID
In the lower pane of the dialog, choose Yes for Group Header.
Drag the CopyForName field into this new header section if you wish to
display that.

You should now get a copy for each person, with their name at the top.

Depending on your actual data structure, you may need to modify the approach
some, but the basic idea is to use a Cartesian product to generate a record
for each copy you want, so there is no need to mess with the PrintOut to set
the number of copies.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
Back
Top