Custom Report Footer

JHB
Sorry - but it is still not correct, the code will produce 3 reports, with the same name/ID.
I thought thar is what the OP wanted - effectively three copies of an invoice but each 'stamped' with slightly different information - like 'customer copy', 'Office Copy'
 
JHBI thought thar is what the OP wanted - effectively three copies of an invoice but each 'stamped' with slightly different information - like 'customer copy', 'Office Copy'
Yeah - Eljefegeneo says he want that and sometimes not, so ...
But what I saw in the database he posted here, he had 3 different persons - therefore my thought were, oh he wants to send one to each person.
Now he had the option to do what he wants - he had the code for both cases. :)
 
Last edited:
Unfortunately, not quite done. When I apply the code and use acViewPreview, it works fine. However, if I click on the command button in FormA, which is the print command for each of the three reports with different footers, I don't get the desired results. Rather I don't get the TextBox1 – the designation of who's copy the contract is for. And the other three fields, Selection A, B And C print for all three copies.
I reverted to just acViewPreview and ran one report at a time, and it works fine; I can even print the desired version of the report. This is shown on FormA1.
It seems that the OpenArgs are not being passed when the DoCmd.OpenReport "ReportA1", , , "[ID] = " & Me![ID], , "1" is run but is when the DoCmd.OpenReport "ReportA1", acViewPreview, , "[ID] = " & Me![ID], , "1" is run.
I know that I must be forgetting something, but can't figure it out.
 

Attachments

Then use:
DoCmd.OpenReport "ReportA", acViewReport ...
 
But, wouldn't that mean that I couldn't use this code (with the OpenArgs) to print the three pages of the report without viewing them first? I want to use similar code when printing my invoices, which also have three different "footers".
 
I tried to open it in acViewReport, then to use PrintOut, but it also prints the form. PrintOut won't permit me to specify only the report. I thought of closing the form first (where the command button is located to execute the code) but then the code stops since the form isn't open any more and the ID is lost.
 
Yes I see, I can't remember it has been such a pain to print a report before, (it is like if you can one thing, you can't the other and versa and visa). :mad:
The below should do it now, I have had the report printed out and 3 different copy are printed.

Code:
DoCmd.OpenReport "ReportA", acViewPreview, , "[ID] = " & Me![ID], , "1"
DoCmd.PrintOut
DoCmd.Close acReport, "ReportA"
DoCmd.OpenReport "ReportA", acViewPreview, , "[ID] = " & Me![ID], , "2"
DoCmd.PrintOut
DoCmd.Close acReport, "ReportA"
DoCmd.OpenReport "ReportA", acViewPreview, , "[ID] = " & Me![ID], , "3"
DoCmd.PrintOut
DoCmd.Close acReport, "ReportA"
 
Finally had a chance to try it today and it works fine. Thank you for all your time and patience. the only question I have is why is has to be this way, that is, open in AcViewPreview and then print it instead of just printing it. Are the OpenArgs lost?
 
If you just print it, the event where the code for OpenArgs is not fired.
Like I wrote before if you can one thing, you can't the other and versa and visa. :mad:
But at last you got it to work. :D:D
 

Users who are viewing this thread

Back
Top Bottom