Some subreports hidden when no data, others visible!?

K

Kjell Harnesk

I have a report with 5 subreports. I believed I had built them from the
same template but one of the subreports show up in the report even if it
has no data. The others don´t. Is there a setting for this or what else
have I missed.

Another thing is that I have a control on the main report that sums a field
in each subreport. but it fails when there is not data in all the subs.
Tried Nz but of course that failed, seems like the subreports does not
exist when they have no data rather than being hidden. How do I solve it so
that the control sums those fields that have data and skips those who
don´t?
 
M

Marshall Barton

Kjell said:
I have a report with 5 subreports. I believed I had built them from the
same template but one of the subreports show up in the report even if it
has no data. The others don´t. Is there a setting for this or what else
have I missed.

Another thing is that I have a control on the main report that sums a field
in each subreport. but it fails when there is not data in all the subs.
Tried Nz but of course that failed, seems like the subreports does not
exist when they have no data rather than being hidden. How do I solve it so
that the control sums those fields that have data and skips those who
don´t?


Subreports with no data do not display, so yours must have
some data, even if its fields are all empty. Try opening
the report's record source table/query in sheet view and
looking for an empty record.

You're right about subreport's not existing when they have
no data. You can test for this condition in a main report
text box with something like:

=IIf(subreport.Report.HasData, subreport.Report.totalbox, 0)
 
K

Kjell Harnesk

Subreports with no data do not display, so yours must have
some data, even if its fields are all empty. Try opening
the report's record source table/query in sheet view and
looking for an empty record.

It had no empty records, it did not even dissapear when I removed all the
fields from the sub so it could not possibly have any data. Well I was kind
of stuck so in desperation I created a new subreport with the same content
and it works OK. Something must have been corupt in the first one.
You're right about subreport's not existing when they have
no data. You can test for this condition in a main report
text box with something like:

=IIf(subreport.Report.HasData, subreport.Report.totalbox, 0)

This worked perfectly, thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top