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

  • Thread starter Thread starter Tony Williams
  • Start date Start date
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
 
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
. . .
 
Thanks Marsh. Presumably that code would go in an event. Which event would I
put it in?
Thanks again
Tony
 
Sorry Marsh shouldn't that be Has No data? I want the labels to show if the
subreport hasn't any data.
Tony
 
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
 
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
 
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
 
Back
Top