Display 0 in Form if Subform is Empty

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

Guest

I want to display a calculated field in a form from a subform. The subform
may or may not have data. I have it working so that if there is data in the
subform it works great. If there is no data I get an Error# message.

=IIf([Forms]![TankBasics]![zzzTankBasics_History]!Location_ID Is
Null,0,[Forms]![TankBasics]![zzzTankBasics_History]!Location_Overall_Total)

Any ideas?

Thanks.
 
Try testing the count of records like this:
=IIf([zzzTankBasics_History].[Form].[RecordsetClone].[RecordCount] = 0, 0,
Nz([zzzTankBasics_History].Form!Location_Overall_Total,0))
 
Works like a charm.

:-D

Allen Browne said:
Try testing the count of records like this:
=IIf([zzzTankBasics_History].[Form].[RecordsetClone].[RecordCount] = 0, 0,
Nz([zzzTankBasics_History].Form!Location_Overall_Total,0))

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

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

Can said:
I want to display a calculated field in a form from a subform. The
subform
may or may not have data. I have it working so that if there is data in
the
subform it works great. If there is no data I get an Error# message.

=IIf([Forms]![TankBasics]![zzzTankBasics_History]!Location_ID Is
Null,0,[Forms]![TankBasics]![zzzTankBasics_History]!Location_Overall_Total)

Any ideas?

Thanks.
 
Back
Top