Supressing the #Error Message

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

Guest

Hi,

When I run a report that has no results, I get a #Error message. Is there a
way to have it so that nothing shows rather than this error message?

Thanks,
 
Any calculated controls tend to show #Error when the report has no records.
You can fix this by testing the HasData property of the report within an
IIf() expression.

For example, if you have a text box with Control Source of:
=Sum([Amount])
change it to:
=IIf([Report].[HasData], Sum([Amount]), Null)

It might be better to just cancel the report's NoData event so that the
report doesn't open at all when if has no data. (If you do this, and you
open the report programmatically, you will need to trap error 2501 in the
code that calls OpenReport.)
 
Back
Top