Subreport problem

  • Thread starter Thread starter Amateur
  • Start date Start date
A

Amateur

I have a report with a subreport.
I would like that the subreport is not shown if there is no data to show.
I am trying to do this with creating a code on the OnActivate event of the
main report – without any luck, because I have not the slightest idea how to
continue. This is what I thought is correct so far (can someone tell me how
it should be correct?

If Me![deporesponsable].Report.HasData = False Then ……… No idea how to
continue

Thanks for any help
Klaus
 
Klaus, you don't need code for this.

If there is no data to show in the subreport, nothing shows.
 
Hi Allen

I do need a code for that - I'll try to explain why.
Your answer is correct - but - I need a little heading over the subreport.
If I do this heading in a Text box it's always shown.
So, I tried to use the subform label as a heading - but this is always shown
as well -even if the subform has no data.
I though that, if I can write a code that the subform is not shown at all
(if there is no data), I can get rid of my heading problem as well.

Or - is it possible that, a textbox is not shown if the subreport
"deporesponsable" has no data?

Thanks
Klaus


Allen Browne said:
Klaus, you don't need code for this.

If there is no data to show in the subreport, nothing shows.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Amateur said:
I have a report with a subreport.
I would like that the subreport is not shown if there is no data to show.
I am trying to do this with creating a code on the OnActivate event of
the
main report – without any luck, because I have not the slightest idea how
to
continue. This is what I thought is correct so far (can someone tell me
how
it should be correct?

If Me![deporesponsable].Report.HasData = False Then ……… No idea how to
continue
 
Try setting the text box's Control Source to something like this:
=IIf([deporesponsable].Report.HasData, "xxx", Null)
where xxx represents the text you want to show when the subreport has data.

Either that, or put the text in the Report Header of the subreport, instead
of on the main report.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Amateur said:
I do need a code for that - I'll try to explain why.
Your answer is correct - but - I need a little heading over the subreport.
If I do this heading in a Text box it's always shown.
So, I tried to use the subform label as a heading - but this is always
shown
as well -even if the subform has no data.
I though that, if I can write a code that the subform is not shown at all
(if there is no data), I can get rid of my heading problem as well.

Or - is it possible that, a textbox is not shown if the subreport
"deporesponsable" has no data?

Thanks
Klaus


Allen Browne said:
Klaus, you don't need code for this.

If there is no data to show in the subreport, nothing shows.

Amateur said:
I have a report with a subreport.
I would like that the subreport is not shown if there is no data to
show.
I am trying to do this with creating a code on the OnActivate event
of
the main report – without any luck, because I have not the slightest
idea how to continue. This is what I thought is correct so far (can
someone tell me how it should be correct?

If Me![deporesponsable].Report.HasData = False Then ……… No idea
how to continue
 

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

Back
Top