print report several times with different title

pduran

Registered User.
Local time
Today, 21:42
Joined
Nov 21, 2006
Messages
14
Hi all

I'm new in access and i'm sure this should be an easy one, but...

I have a report that i want to print several times, each time with a diferent title. Is it possible to have a text box or label and change it betwen prints? (OpenReport in a macro)

I could have several reports on this access but then it would be too heavy!

Any ideas?
Many thanks

Paulo Duran
 
Is the data on the report going to be unchanged? If so and all you want is a different title, you could have, say, five text boxes on a form, along with a button. The user enters up to five different titles and clicks on the button. The code says something like

Open report XYZ in design mode
Set it's title to the first text box value
Save the change
Print it

If the second text box isn't empty, repeat for text box 2

If the third text box isn't empty, etc, etc.

Any use?
 
in the open event for the report, set the label to whatever you want - caption is the property you need

reportlabel.caption = "whatever i need"
 
Thank you Matt and Gemma,

This report is an invoice. I need 3 copies (one original to the client and 2 internal "process" and "account") and they must be automatic or some of the copies will miss. that why i think the button option is not the best for me. I think the "reportlabel.caption = "whatever i need" should be the way... but i cant find where do i code that!

thanks
Paulo Duran
 
I would just create three sepeate copies of the report.
 
I say that on my original post. the report have several images and its quite big. If i have 3 reports ... Its too big to send through the net.
 
I was trying to test different code for this and I can't get it to work. I know that there is a way to change labels on the report at run time but I can't figure out how to get it to print in between. I keep getting an error.
 
What do you mean it is to big to send through the net? Are you sending the hole database?

If you don't want to create the seperate reports then you will need to create a custom procedure to change the title and print the report. You could also add a parameter to prompt for the title.
 
I know you can do this other ways, but i generally use global variables.

you need a globavariable "timesprinted"

then in the openreport have

select case timesprinted
case 1: reporttitle.caption = "first copy"
case 2: reporttitle.caption = "second copy"
case 3: reporttitle.caption = "third copy"
end select

however you print the invoice in code, you then need

for timesprinted = 1 to 3
docmd.openreport "myinvoice"
next timesprinted
 
Gemma

I wrote your code in a button on a form and it doesnt do anything! No error, no label with caption changed... nothing!
It like it just ignores the code! its incredible!
 
it may depend how Access actually manages the value of a control loop.
perhaps you have to say instead

dim index as long

for index = 1 to 3
timesprinted = index
docmd.openreport "myinvoice"
next index


however, i also assume you have changed the reporttitle label to whatever you label you are actually using.
 

Users who are viewing this thread

Back
Top Bottom