Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can main report know count of subreport items before run? 1

Status
Not open for further replies.

meryls

Technical User
Nov 20, 2003
62
US
I have two recordsets being passed from a VB 6.0 program. I link these recordsets in the Database Expert using the customer number fields in both recordsets.

Recordset 1 is work orders and I use this in the main report.
Recordset 2 is a set of items that I use in the subreport.

In the main report, I group on customer number and then on work order number. For each work order, in the work order footer, I insert the subreport to show a list of the items in that recordset for the same customer number. (It is okay that there may be more than one work order being created for a customer, showing the list of items in the subreport on all work orders for a given customer).

This is working fine, but there are cases where there are no entries in Recordset 2 for a particular customer number. In that case, I would like to suppress the subreport, which prints on a separate page, as an addendum to the work order. However, I haven't used the data from Recordset 2 in the main report. Is there any way I can get a count of the matching records in recordset 2 while I am in the main report?

Thanks for the help!
Meryl
 
If the subreport is in its own section, you may be able to suppress it when the subreport is blank. This depends on the version of Crystal - 8.5 can't but 9 and above can.

I can't unfortunately tell you how to work out your Crystal version from VB. It's well worth finding it out, maybe from the software supplier, and including it in future. posts

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
PS; in Crystal 10, you right-click on the subreport, chose [Format Subreport] and check the 'Suppress Blank Subreport' option. For the section, right-click, [Section Expert] and check the 'Suppress Blank Section' option.

In Crystal 8.5, there was a work-round that involved running the sub-report twice, the first time very small and returning a Shared Variable that could be used to suppress the main run of the subreport.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I am using Crystal 9.
If I have headings in the subreport, can I still find a way to make the subreport blank?

Thanks,
Meryl
 
Put supression in the headings, to apply if there is nothing to report. This can be done by testing isnull((subreport.field}).

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Madawc,

Thanks for your help. I ended up using the work-around with the small subreport and shared variables.

Meryl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top