Do Not Show Subform When There Is No Data

CCIDBMNG

Registered User.
Local time
Yesterday, 21:40
Joined
Jan 25, 2002
Messages
154
Does anyone know how to stop the subreport from showing if there is no data? Right now I have a main report and two subreports linked to it. I also have a page break before each subreport. If there is no data in the subreport it just prints a blank page. I don't want the blank page if there is no data. I've tried in the NoData Event putting cancel = true and docmd.cancelevent but neither worked.
 
Try this;

1) make the height of the subreport tiny
2) set the Can Grow property of the subreport to Yes

RichM
 
It doesn't work because I have page breaks before each subreport. So it still forces a new page.
 
Rich, I'm not too familiar with the HasData Method. What would I put in there?
 
Ok I have done some research on the hasdata method but when I try to use it I get an error stating "Object does not support this property or method" I tried setting the page breaks to invisible and then said if the subreport.hasdata = -1 then set the page break to visible. Anyone know what I am doing wrong?
 
I don't use page breaks so I'm not sure if this will work, it works with labels etc.
Me.MyPageBreak.Visible = Me.MySubreport_subreport.Report.HasData
 
Thank you soooo much Rich that worked perfectly. I tried something like that among the many other things I tried but couldn't get it to work. Thanks again.
 
Rich,
I have read every thread (many of them are old) I am using '03. Where exactly do I place this (I don't have the problem with Page Breaks, I am simply trying to prevent subreports from displaying when they have no data):
Me.MyPageBreak.Visible = Me.MySubreport_subreport.Report.HasData
Do you use the code builder in the properties page to which of these do you use? OnOpen...

I have tried everthing, and I know you are tierd of hearing from me.
 

Users who are viewing this thread

Back
Top Bottom