Error value in calculated control when no records

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

Guest

I have a report that has a textbox in the footer that is using the sum aggregate function to calculate a total price
If there are records, the calculated field works fine. If there are no records, the calculated control shows a
#Error value in the control

I have a form that does the same thing, but it does not give an error. It is just Null
 
The simplest way to avoid this is to cancel the report's NoData event.

If you prefer, you can use the HasData property of the report in the
ControlSource of the text box:
=IIf([Report].[HasData], Sum([MyField]), Null)

The reason forms behave differently is that they go to a new record. A form
that cannot accept new records (e.g. if its AllowAdditions property is No)
gives the error like the report does when you refer to something that does
not exist.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Kathy said:
I have a report that has a textbox in the footer that is using the sum
aggregate function to calculate a total price.
If there are records, the calculated field works fine. If there are no
records, the calculated control shows an
 
Back
Top