#Error on no data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a report that works great when there is some information from the
query that supplies the data. However, if there is no data available then
the form produces the #Error message is various places. Is there a way to
prevent this something on the lines of ISError?

Am I close to the idea and if so where would be the best place to put the
code? Many thanks for taking the time to ready this. Any and all help much
appreciated.

Debbie D.
 
Instead of taking care of the error, display a message that there is no data
to display, and close the report

On the OnNoData Property of the report write the code

MsgBox "No Data"
Cancel = True
 
Debbie said:
I have a report that works great when there is some information from the
query that supplies the data. However, if there is no data available then
the form produces the #Error message is various places. Is there a way to
prevent this something on the lines of ISError?

Am I close to the idea and if so where would be the best place to put the
code? Many thanks for taking the time to ready this. Any and all help much
appreciated.


Presumably, the #Error is appearing in a text box that
refers to a total text box's value in the subreport's
header/footer section.

If that's a valid deduction, then the main report text box's
expression should be along these lines.

=IIf(subreport.Report.HasData, subreport.Report.total, 0)
 
Ofer,

Thanks, worked great!

Ofer said:
Instead of taking care of the error, display a message that there is no data
to display, and close the report

On the OnNoData Property of the report write the code

MsgBox "No Data"
Cancel = True
 
Marshall,

Have now tried both of the inputs from this question that you kindly
answered. Works great. Thanks!!
 
Back
Top