Multi-part report

GJT

Registered User.
Local time
Today, 17:57
Joined
Nov 5, 2002
Messages
116
Hi

I want to 'cleanly' be able to print out multiple instances of a report with a small variation between each print.
eg. I need to print an invoice report and also an advice note. The advice note mirrors the invoice in all ways except that the header reads 'advice note' as opposed to 'invoice'.

Can I do this with one form (with code to change the header label between prints) - as opposed to creating a dulicate form? I would also like to issue the print call from my application which will print both these documents in one go - i.e. one after the other.

Any help is greatly appreciated.

Thank you.
 
There are several ways to do this, create a copy of the original and just change the caption, add the same detail to the original report in one of the footers change the caption for the next page
 
Hi,
I can see what you what to do I think.
I presume you are using a button from a form to print the report

I would try something like this.

On the event procedure for the print button I would set a variable, e.g. reportformat = 1
(one easy way to make his available to the report is to put it on the form and make it invisable.)
I would then have the caption on the report as a text box with a data source of
iif((formname!reportformat = 1),"This is an invoice","This is an advice note")

you could get both to print by using the event procedure of the print button to set the value of reportformat and usint the print command , then resetting the value of reportformat and printing again.

I hope this helps,

do come back to me if I am completely off the track, and I will try to help, again.

Sue
 
Sue
I am priting these reports from a dialog box where the invoice number gets entered once and press OK i.e. what I want to do is with one button press - print the two reports .

Rich
I do not want to duplicate the form, that is a MESSY solution! Much nicer to have code do the work for you.... you mention several ways of doing this - what are the others??
 
Hi,

I don't think is is possible to put your own code behind the button on a standard access dialog box, so you will have to create your own pop up form.

create a small form with a text box as per your dialog box, and a button with the text OK, on it.

If you use the wizzard, you can get it to produce the code for printing the report.

Call your own form instead of the dialog box from wherever you were calling the dialod box..

In the custom form, find the event action for the ok button, and add the code to set the variable to determine which version of the report to print, before the print command, repeat this for the other version of the report, and copy the print command, and put a docmd.close before the end of the routine, and the reports should both print, the pop up form should close and everything should be great.

if you ahve any more problems come back to me, or if you want to post a copy of the bits oif the database you are having trouble with I will have a look.

Sue
 
I guess I havent made myself too clear .......

i have the dialog box coded. everything works just fine - but I currently print one report which is formatted exactly the way i want it. Except I want it to print another report same as the first but with a different label i.e. advice note instead of invoice.

I DO NOT WANT to duplicate the report. I want to know if anyone has been able to issue the single print call to spool the first report / run the formatting code to change the label detail and then spool this second instance of the same report to the printer. Trust this is clear!!!!.......isnt it?????

Thanks
 
Assuming you are printing the two copies at the same time, I gave you the answer, where does the FORM come into the equation?
 
Rich

Sorry form is definitely a bad choice of word in this context - should be report.
 
Hi I really think I understand now!

I have attached a sample database whith 1 form and 1 report.

When you press the print button on the form you get two copies of the report with different captions.

The things to need to look at to make it work for you are:

1. text box on form which is hidden but called something sensible.
2. code behind button which sets value of control on form and then prints, then resets value on form to something else and prints again.
3. iif function used in text box for the caption to your report. You can't do this with a label used for the caption. If in the future another box changes, or you dont want a field to appear in one of the reports, you can use this same technique

I don't think it is possible to reformat the report from within the report and print it twice, but I don't know everything about access!!!!!! (who does).

I hope I have given you the answer you wanted, if not I'm afraid I might have to give up.

Sue
 

Attachments

Sue

Thanks for your help - I am using Access 97 - can you send the DB in this format please?

Thanks
 
Sue

Thats just the ticket! Thanks...... dont s'pose you can help with this old'n can you ?

Old query
 
Hi,

I presume you can just send the report to print rather than preview,
the command would be
DoCmd.OpenReport stDocName, acNormal
rather than
DoCmd.OpenReport stDocName, acPreview

If the button on the sample database I sent you sent the report straight to the printer then this should be OK.

If this is not the answer, then I don't have any other ideas

Sue

ps If I want to open reports forms print etc from a form I always use the wizard to produce the code for me, saves typing and typos! you can always edit it afterwards.
 

Users who are viewing this thread

Back
Top Bottom