Supressing the #Error Message

C

ChuckW

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,
 
A

Allen Browne

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.)
 

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