I need to suppress printing the main and the subreport unless there is data in my subreport line. If there is data in the subreport, in other words, that's the only time I want to show both.
You are going to have some trouble with that because the main report fires before the subreport, and it won't know yet whether there is going to be any data for the subreport.
You can restrict the data coming into the report by linking the datasource for the main report to the datasource for the subreport within a query
Example:
ParentTable (report datasource)
ParentID ParentName
101 Bill
102 Nancy
103 Helen
ChildTable (subreport datasource)
ChildID ParentID Name
201 101 Bill, Jr.
202 101 Carrie
203 103 Jamie
204 103 Tina
Use this as the datasource for the main report:
Select ParentID, ParentName
From ParentTable
Inner Join ChildTable
On ParentTable.ParentID = ChildTable.ParentID
Use this as the datasource for the subreport:
Select ParentID, ChildName
From ChildTable
Link the reports on the ParentID
Nancy will never appear on the report because she has no children. I am sure your situation is not so basic but you may be able to apply the same principle.
Thanks lynchg for your speedy reply. I have tried one change that seemed to make sense: I have formatted the detail line of the subreport conditionally. That is I found a field in the detail line, and wrote, 'if isnull({cust.acct}) then true, else false' I hope that will suppress the sub report lines when there is nothing there. I can deal with the report if there are detail and subreport lines both. That job is running so, we'll see.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.