Discussion Locked

Access and Division Expression

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am having a problem with Dividing by zero errors within a Query. The database has to have default values of 0 because this database application needs to generate negitve number variances. I am currently getting a #Error message within the querry field. But any field with positive or negative numbers is generating the correct number.

The expression is
1 This is the definition:
(([Table_orQuery])![Table_name_1]/[Table_or_Query]![Table_Name_2]))

Can anyone please give me some insite.
Thanks

2 replies

by goodmanr

You need to use the "immediate if" statement in order to test for the 0 value. The format is:
iif([Divideby_Field_name]=0,true expression,([Table_orQuery])![Table_name_1]/[Table_or_Query]![Table_Name_2])

by sjbement

Expr1: IIf([Tbl]![Denominator]=0,"N/A",[Tbl]![Numerator]/[Tbl]![Denominator])

Semper Fi,
Red

This discussion is closed to new replies.