Print report from within a report

Hi I’m trying to print a second report during the printing of invoices. Every invoice can have an extra specification with the same number as the invoice. If this specification is present, I want it to be printed together with the invoice. Can anyone indicate what is the best way to do this ? Regards R

I do not know if this is the “best” way to do it, at least that is the way I’m using. I generate a new report (processingonly = yes) with table “Sales Invoice Header” as data item. In the “OnAfterGetRecord” I’m assigning the current record to a variable of the same time and calling a SETRECFILTER on that one. Then running the report 1. After checking the conditions for having another report printed or not I’m calling a second (and third) report in the same way.

It works, thanks. Is there a way to print the second report without a request form ? I want to use the choices that the user made for the main report when printing the detail report. I don’t want to bother the user with the request form after every printed invoice ! Thanks

Basically you should call the original invoice and the details report without the request form (i.e. Report.USEREQUESTFORM = FALSE), Nevertheless you need to have a copy of the original request form of the invoice in the calling report. Additionally you need a function in the invoice (and the detailed report) which sets the options of the request form to the same values as entered in the calling report.

Strange things are happening: after previewing the invoice on the screen I can also preview the detail report. But when I chose to print the main report then the detail report is nowhere to be found ! Not on the screen, not on the printer !

I now suffer the same problem as mentioned in this topic:,form :frowning: Back to the good old drawing board… The only way I can see this working is when there’s NO request form for the detail report. But it HAS to print to the same printer that was chosen on the request form of the main report… Is there a way to achieve this ?

Yeap, there is a way to do that, but a strange one [;)] If you do not change the printer the system would select either your standard printer or the printer assigned to the report ID/user combination. So if you would create a “Printer Lookup” window to the “Printer” table (LookupFormID = 356) in the request form on the calling report, and you set the report to ProcessingOnly you do not have a preview/print button anymore, just an OK and Cancel. Before you are calling the first report you are wrinting to the “Printer Selection” table the combination of your user ID, report ID for both reports and selected printer. Just remember to remove the changes OnPostReport of the calling report.

Hello, If you add the second report in REPORT SELECTION under the Standard Sales Invoice Report, system will print both the reports for you. No need to call one from another.