L
Lowell Moorcroft
Hello, all -
I'm having some problem conceiving how to execute a task.
I have an invoice report which needs to go to four
different types of customer, hence will take four
different recordsources. I'm planning to set the report to
different recordsources depending on which of four buttons
on a form is pressed. Each report then needs to be
exported, since these are invoices that need to be
preserved and not updated. I'm planning on using the
OutputTo method on the form where the report is selected,
along with acFormatRTF as the output format.
But two of the four reports need to be split up into one
report per record in the recordsource, since each invoice
record needs to be attached eventually to an e-mail
message, one message to each billee.
So how do I assign the recordsource to the report, but
cycle through the records so that OutputTo assigns each
record to a file?
Thinking about this so far has confused me as to how the
code should be distributed between the report and the
calling form. I find myself trying to confine the code to
just the form, since it seems the OutputTo has to be run
outside the report (or does it?).
I'm inclined to swap the recordsources for the invoice
report to avoid making four identical reports, each with
its own recordsource. This is in case the report needs to
be revised which therefore could be done in one report,
not four. In a pinch, though, I would make four reports.
But combining 1) assignment of the recordsource; 2) record
looping; and 3) the output to file, is what is daunting me.
The air code in the form would look like this, under my
current conception:
strSQL = SELECT, etc....
report.recordsource = strSQL
For each record in report.recordsource.open(strSQL)
DoCmd.OutputTo, etc.....
Next record
Does this look like it would work? Would something else
work better?
Thanks
Lowell Moorcroft
I'm having some problem conceiving how to execute a task.
I have an invoice report which needs to go to four
different types of customer, hence will take four
different recordsources. I'm planning to set the report to
different recordsources depending on which of four buttons
on a form is pressed. Each report then needs to be
exported, since these are invoices that need to be
preserved and not updated. I'm planning on using the
OutputTo method on the form where the report is selected,
along with acFormatRTF as the output format.
But two of the four reports need to be split up into one
report per record in the recordsource, since each invoice
record needs to be attached eventually to an e-mail
message, one message to each billee.
So how do I assign the recordsource to the report, but
cycle through the records so that OutputTo assigns each
record to a file?
Thinking about this so far has confused me as to how the
code should be distributed between the report and the
calling form. I find myself trying to confine the code to
just the form, since it seems the OutputTo has to be run
outside the report (or does it?).
I'm inclined to swap the recordsources for the invoice
report to avoid making four identical reports, each with
its own recordsource. This is in case the report needs to
be revised which therefore could be done in one report,
not four. In a pinch, though, I would make four reports.
But combining 1) assignment of the recordsource; 2) record
looping; and 3) the output to file, is what is daunting me.
The air code in the form would look like this, under my
current conception:
strSQL = SELECT, etc....
report.recordsource = strSQL
For each record in report.recordsource.open(strSQL)
DoCmd.OutputTo, etc.....
Next record
Does this look like it would work? Would something else
work better?
Thanks
Lowell Moorcroft