On No Data - Print Report, But Show 0 For Value

  • Thread starter Thread starter Karl Burrows
  • Start date Start date
K

Karl Burrows

I want to be able to preview a report regardless of whether it has data or
not, but when there is not data, instead of returning #ERROR, I would like
to just show 0's.

Thanks!
 
The error arises where you have calculated controls that refer to
non-existent fields. You can avoid the error by testing the HasData property
of the report.

For example, if you have a text box that has a Control Source of:
=[Quantity] * [PriceEach]
when there is no data, there is no quantity and no price each, so trying to
refer to them yields #Error.

To avoid the problem, change the ControlSource to:
=IIf([Report].[HasData], [Quantity] * [PriceEach], 0)

Note that another cause of #Error on a report is where the Name of a control
is the same as a field, but its Control Source is something else. You may
also need to change the Name of the text box to avoid the #Error.
 
Thank you!!!

The error arises where you have calculated controls that refer to
non-existent fields. You can avoid the error by testing the HasData property
of the report.

For example, if you have a text box that has a Control Source of:
=[Quantity] * [PriceEach]
when there is no data, there is no quantity and no price each, so trying to
refer to them yields #Error.

To avoid the problem, change the ControlSource to:
=IIf([Report].[HasData], [Quantity] * [PriceEach], 0)

Note that another cause of #Error on a report is where the Name of a control
is the same as a field, but its Control Source is something else. You may
also need to change the Name of the text box to avoid the #Error.
 
Back
Top