How do I create a report that shows the control names when no data?

T

Tony Williams

I'm trying to create a report made up of about 10 subreports. Creating the
report isn't a problem but I want the subreports to show the control labels
even if there isn't any data (similar to a form) I've tried various formats
but can't get it to work. Anyone any idea how I can force the control labels
to show on a sub report even if there isn't any data for that report?
Thanks
Tony
 
M

Marshall Barton

Tony said:
I'm trying to create a report made up of about 10 subreports. Creating the
report isn't a problem but I want the subreports to show the control labels
even if there isn't any data (similar to a form) I've tried various formats
but can't get it to work. Anyone any idea how I can force the control labels
to show on a sub report even if there isn't any data for that report?


AFAIK, you can't make a subreport display anything when it's
record set is empty.

The usual approach for this kind of thing is to place a
duplicate set of lables on the main report and make them
visible or not depending on whether the subreport has any
data:

Me.lbla.Visible = Me.subreport.Report.HasData
. . .
 
T

Tony Williams

Thanks Marsh. Presumably that code would go in an event. Which event would I
put it in?
Thanks again
Tony
 
T

Tony Williams

Sorry Marsh shouldn't that be Has No data? I want the labels to show if the
subreport hasn't any data.
Tony
 
M

Marshall Barton

It would go in the Format event of the section that contains
the subreport.
 
M

Marshall Barton

Tony said:
Sorry Marsh shouldn't that be Has No data? I want the labels to show if the
subreport hasn't any data.


My mistake. You are correct.
Me.lbla.Visible = Not Me.subreport.Report.HasData
 
T

Tony Williams

Hi Marsh tried your code and substuted the name of my subreport and my main
report but got an error message to say Method or Datamember not found
Here's mu line of code
Me.lblnoinfo.Visible = Not Me.rptCReDriving_Licence.eptCREdithirer2.HasData
Any ideas?
Thanks
Tony
 
M

Marshall Barton

Tony said:
Hi Marsh tried your code and substuted the name of my subreport and my main
report but got an error message to say Method or Datamember not found
Here's mu line of code
Me.lblnoinfo.Visible = Not Me.rptCReDriving_Licence.eptCREdithirer2.HasData

Whoa, what is the eptCREdithirer2 thing?

Assuming that rptCReDriving_Licence is the name of the
subreport ***control*** on the main report (not necessarily
the same as the name of the report object it displays), the
reference should be:

Not Me.rptCReDriving_Licence.REPORT.HasData
 

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