OnNoData on subreport not firing

M

mcescher

I have a subreport that came up empty today, and I would like to have
a small message show up.

I added a hidden label with my message, and then in the NoData routine
set it to visible.

Private Sub Report_NoData(Cancel As Integer)
lblError.Visible = True
End Sub

It runs correctly when I open the sub report normally, but when I open
the main report, I just get a big white space. Am I missing
something?

Thanks,
Chris M.
 
M

Marshall Barton

mcescher said:
I have a subreport that came up empty today, and I would like to have
a small message show up.

I added a hidden label with my message, and then in the NoData routine
set it to visible.

Private Sub Report_NoData(Cancel As Integer)
lblError.Visible = True
End Sub

It runs correctly when I open the sub report normally, but when I open
the main report, I just get a big white space. Am I missing
something?


Subreports with no data will not display anything.

Put a text box on the main report, next to or on top of the
subreport control and set its control source expression to
something like:
=IIf(subreportcontrol.Report.HasData, Null, "No data
available")
 
M

Marshall Barton

mcescher said:
I have a subreport that came up empty today, and I would like to have
a small message show up.

I added a hidden label with my message, and then in the NoData routine
set it to visible.

Private Sub Report_NoData(Cancel As Integer)
lblError.Visible = True
End Sub

It runs correctly when I open the sub report normally, but when I open
the main report, I just get a big white space. Am I missing
something?


Subreports with no data will not display anything.

Put a text box on the main report, next to or on top of the
subreport control and set its control source expression to
something like:
=IIf(subreportcontrol.Report.HasData, Null, "No data
available")
 
M

mcescher

Subreports with no data will not display anything.

Put a text box on the main report, next to or on top of the
subreport control and set its control source expression to
something like:
        =IIf(subreportcontrol.Report.HasData, Null, "No data
available")

Thanks for the quick reply Marsh. I wasn't able to get it to work
exactly like that, but, I did in the OnFormat section of the report.
I added a text box and made it not visible. Then in the OnFormat
code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
lblNoData.Visible = Not rptState.Report.HasData
End Sub

Thanks again for your help,
Chris M.
 
M

mcescher

Subreports with no data will not display anything.

Put a text box on the main report, next to or on top of the
subreport control and set its control source expression to
something like:
        =IIf(subreportcontrol.Report.HasData, Null, "No data
available")

Thanks for the quick reply Marsh. I wasn't able to get it to work
exactly like that, but, I did in the OnFormat section of the report.
I added a text box and made it not visible. Then in the OnFormat
code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
lblNoData.Visible = Not rptState.Report.HasData
End Sub

Thanks again for your help,
Chris M.
 
M

Marshall Barton

mcescher said:
Thanks for the quick reply Marsh. I wasn't able to get it to work
exactly like that, but, I did in the OnFormat section of the report.
I added a text box and made it not visible. Then in the OnFormat
code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
lblNoData.Visible = Not rptState.Report.HasData
End Sub


Good work.

That is the way to do it when there is some other stuff that
can get in the way (e.g. the text box has a border).
 
M

Marshall Barton

mcescher said:
Thanks for the quick reply Marsh. I wasn't able to get it to work
exactly like that, but, I did in the OnFormat section of the report.
I added a text box and made it not visible. Then in the OnFormat
code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
lblNoData.Visible = Not rptState.Report.HasData
End Sub


Good work.

That is the way to do it when there is some other stuff that
can get in the way (e.g. the text box has a border).
 

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