I am creating a database to keep track of Purchase Orders.
I would like the report to print out 4 copes slightly different
1 Marked "Accouning Copy"
2 Marked "Department Copy"
3 Marked "Requestor Copy"
4 Marked "Vendor Copy"
Is there a way to do this? I have had no luck trying to figure it
out.
Thank you
Use Gina's solution. Just for the sake of it, I'll type a different
way.
You could open and print the report four times with code like this:
public sub PrintFourCopies(strReportName as String)
DoCmd.OpenReport strreportname, acViewNormal, , "1=1"
DoCmd.OpenReport strreportname, acViewNormal, , "2=2"
DoCmd.OpenReport strreportname, acViewNormal, , "3=3"
DoCmd.OpenReport strreportname, acViewNormal, , "4=4"
end sub
Here we pass the report a "bogus" filter string. Now we want to use
the filter string in the report's events to change the caption/header
of the report. You can place the following code in many places: In the
report header OnFormat for instance, or (I believe) in the report's
OnActivate or OnLoad events.
public sub PutThisCodeInSomeEvent()
if me.filter <> "" then
select case val(left(me.filter, 1))
case 1
me.someLabelOnYourReport.Caption = "Accounting Copy"
case 2
me.someLabelOnYourReport.Caption = "Foo Copy"
case 3
me.someLabelOnYourReport.Caption = "Bar Copy"
case 4
me.someLabelOnYourReport.Caption = "Zot Copy"
end select
end if
end sub
Ok. So that's a complicated way of passing the header to a report. If
you want the title in a text box instead of a label, instead of
"me.someLabelOnYourReport.Caption =" use
"me.someTextBoxOnYourReport.Value = "=""Accounting Copy"""" - remove
the outer quotations. Sorry if that gets confusing.
Other ways to do this: Bind a control on your report to a text box on
a form and let the user specify their own title. . .
Lots of ways. Use Gina's though.
-Kris