#Error in a report

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

Guest

I have used the following statements in a report:

=IIf("#Error",0,[Field 1])
=IIf([Field 1]="#Error",0,[Field 1])
=nz([field 1], 0)


The report will show #Error if there is no data for the report, so when I
use this If statement it will replace the #Error with 0. The only problem is
when there is data available, it still keeps the 0 and it won't show the
correct data. I know that it will show data, if there is data for the report
and I take out the If Statement. Anyone else seen this issue and know how to
resolve?
 
Decemuirs said:
I have used the following statements in a report:

=IIf("#Error",0,[Field 1])
=IIf([Field 1]="#Error",0,[Field 1])
=nz([field 1], 0)


The report will show #Error if there is no data for the report, so when I
use this If statement it will replace the #Error with 0. The only problem is
when there is data available, it still keeps the 0 and it won't show the
correct data. I know that it will show data, if there is data for the report
and I take out the If Statement. Anyone else seen this issue and know how to
resolve?


You can use the IsError function for this:

=IIf(IsError([field1]), 0 , [field1])

However, it might be a better coding practice to use the
report's HasData property to check specifically for the
report not having any data:

=IIf(Report.HasData, [field1], 0)

Or, possibly, you may want to use the report's NoData event
procedure to deal with that situation.
 
Back
Top