rickbirnie
08-21-2005, 09:51 AM
Not sure if this can be done. But my question is. Is there a way to create
a main report with multiply subreports using Code? What I am trying to do is
create a report that could have one page or mutliply pages depending on the
the data record on a form. The report is a purchase order that may contain 1
item for purchase or several items that would not fit on one page. Also
depending on where the items need to be shipped it could require a shipping
instructions page. I have created several one pages reports that I would
like to be able to add to one main report and deside which subreport to add
to the main report at run time.
Thanks Rick
ThreeCrow
08-22-2005, 07:18 PM
What is the deciding factor as to whether these other pages (subReports) print or not.
Pat Hartman
08-22-2005, 08:16 PM
What I am trying to do is
create a report that could have one page or mutliply pages depending on the
the data record on a form. I don't understand your problem. Reports print as many pages as necessory to print all the records in their recordSource query or table.
The detail section of a report prints a single record. If you base the report on a 1-many relationship such as an order and order details, you can use the sorting and grouping properties to print the order data in the order header section and the order details in the report's detail section. You can set page breaks on the order header as necessary.
Alternatively, you can have the main report print only order data and add a subreport that will print the order details.
rickbirnie
08-27-2005, 09:30 AM
First of all thank you for the reply. What I am trying to create is a very structured printable form and is based on an Purchase Order form that is a standard in the office. Our office does purchasing for several different bowling centers, Clubs, lodging facilities, etc.. world wide. The first page has a lot of data concerning Billing, Invoicing, Vendor and shipping information. The second page is just a continuation of the first page but with out all the Billing, Invoicing, etc.. data. So I have created the structure of the form in a reports with the first page having several subreports for the different sections that pull from dynamic/temporary tables. There is a one subreport on the first page the pulls in order details (items descriptions, price, quantity, and total to be purchase). This subreport can only be a certain size and if there are more then 5 items then the report will need to create a second page which is just a continuation of the subreport of the order details. I have created two reports with the first page of the Purchase Order being one being one report and the second being another. I have set the code behind when you wish to preview the report to decide if there are more then 5 items on the order and use a different main report with two subreports with the first page being the first page (one subreport) discussed above and a continuation page (another subreport). So what I have created is reports that are added to the a main report depending on the dynamics of the order. So instead of creating mutliply main reports with the required subreports and choice which one to use in code. What I was wondering if you could add the subreports to a main report in the code instead of having the mutliply main reports with the corresponding subreports. Sorry I wasn't clear in my first post and thanks in advance for any help.
Rick
Pat Hartman
08-27-2005, 03:14 PM
I think you are making this harder than it needs to be. You can build the first page without using subreports as long as all the data is 1-1 with the order. You can add a page break control so that the detail starts on the second page. I think the detail should be a subreport.
It is even easier if each report only prints a single invoice. If that is the case, you can use the Report Header for your first page stuff since the report header is printed only once at the beginning of the report.
Perhaps if you pasted a picture of the first and second pages of a typical invoice, we can provide better help.