Link to home
Start Free TrialLog in
Avatar of RLancaster
RLancaster

asked on

QuickReport: Prevent detail band printing if subdetail empty

Greetings,

How can I prevent a detail band from printing if its associated subdetail band (in a master/detail report) is blank. In the sub detail band I can set its PrintIfEmpty to FALSE but the detail band stays there and it looks kinda silly especially if I want to print each master record and its associated data on a new page.

Thanks,

Robert Lancaster

PS: I am an old hand at programming but a child in arms when it comes to Quick Reports :)
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi RLancaster,

don't know how you do it, but have you tried to make a query which contains all the fields from master and detailtable.

then make a group-band for the masterpart, and in the detail-band drop the other fields, to prevent that the detailband is printed, just assign a before-print procedure where you can check self if there anything to print and set the desired boolean-var print-band to true or false.

i guess there are, also other possibilities to do that.

meikl ;-)
Avatar of gdebiasa
gdebiasa

meikl has the right approach.

In the group band, use the OnBeforePrint to check the query for the detail band. If the query has no records (EOF = true or a similar test), then set the AllowPrint variable (not sure of the name, but it is a parameter of the OnBeforePrint method) to false.

This should suppress the header band when the detail band has no records.

Glen
ASKER CERTIFIED SOLUTION
Avatar of Greyman
Greyman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RLancaster

ASKER

You get 50 bonus points for a good answer and for me taking so long to grade the question !!! :)