Calculation Problem

A

Anthony Viscomi

I am trying to make the following caclulation within an Unbound txtBox:

=([H_Fraction_Top]/[H_Fraction_Bottom])+[H_Inch]

My problem is that if the values for H_Fraction_Top and H_Fraction_Bottom
are 0 the #Num! is dispalyed.

What am I doing wrong?

Thanks in advance!
Anthony Viscomi
 
D

Douglas J. Steele

=IIf([H_Fraction_Bottom]=0, 0,
([H_Fraction_Top]/[H_Fraction_Bottom])+[H_Inch])

If there's a chance that the fields are actually Null, rather than 0, try:

=IIf(Nz([H_Fraction_Bottom],0)=0, 0,
(Nz([H_Fraction_Top],0)/[H_Fraction_Bottom])+Nz([H_Inch],0))
 
A

Anthony Viscomi

Thanks!
Douglas J. Steele said:
=IIf([H_Fraction_Bottom]=0, 0,
([H_Fraction_Top]/[H_Fraction_Bottom])+[H_Inch])

If there's a chance that the fields are actually Null, rather than 0, try:

=IIf(Nz([H_Fraction_Bottom],0)=0, 0,
(Nz([H_Fraction_Top],0)/[H_Fraction_Bottom])+Nz([H_Inch],0))

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Anthony Viscomi said:
I am trying to make the following caclulation within an Unbound txtBox:

=([H_Fraction_Top]/[H_Fraction_Bottom])+[H_Inch]

My problem is that if the values for H_Fraction_Top and H_Fraction_Bottom
are 0 the #Num! is dispalyed.

What am I doing wrong?

Thanks in advance!
Anthony Viscomi
 
Top