#Num! Error

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello I am getting the above error in a Text box which has
the following code in it:

=[txtReturnCount]/[txtTotalResponses]*100

This is based on 3 combo boxes which the user see as Text
and the database will work off a number in the main table.

How could I get rid of this error?

Many Thanks

James
 
James,

I suspect this is the result of txtTotalResponses being 0 or null. Use an
IIf statement so you only return a value if this is not true.

HTH,
Nikos
 
Hi
Reading the Microsoft Knowledge Base article No 112103 at
http://support.microsoft.com/default.aspx?scid=kb;en-us;112103 I have to
disagree with Nikos.
Try to:
1. First of all follow the advice of Nikos checking for 0 value, although I
don't thing this is the reason.
2. Use the Cdbl function to convert the values in the TextBoxes into
Doubles. Use the following syntax:
=Cdbl(Nz([txtReturnCount];0))/Cdbl(Nz([txtTotalResponses];0))*100, in order
to avoid problems with Nulls or empties.
(This is always a good approach).
3. Check to see if the TextBox where the calculation is put can store the
result of the calculation.
Regards
Margaritis Paktitis
 
Right ok Surprisingly enough Nikos was rigtht...

It is because its containing a null value...

How do I write my IIF statement?

Many Thanks

James
-----Original Message-----
Hi
Reading the Microsoft Knowledge Base article No 112103 at
http://support.microsoft.com/default.aspx?scid=kb;en- us;112103 I have to
disagree with Nikos.
Try to:
1. First of all follow the advice of Nikos checking for 0 value, although I
don't thing this is the reason.
2. Use the Cdbl function to convert the values in the TextBoxes into
Doubles. Use the following syntax:
=Cdbl(Nz([txtReturnCount];0))/Cdbl(Nz
([txtTotalResponses];0))*100, in order
to avoid problems with Nulls or empties.
(This is always a good approach).
3. Check to see if the TextBox where the calculation is put can store the
result of the calculation.
Regards
Margaritis Paktitis

Hello I am getting the above error in a Text box which has
the following code in it:

=[txtReturnCount]/[txtTotalResponses]*100

This is based on 3 combo boxes which the user see as Text
and the database will work off a number in the main table.

How could I get rid of this error?

Many Thanks

James


.
 
How you write your IIF will depend on what you want to show if the
denominator is Null

Example:
=IIf(Nz([txtTotalResponses],0)=0, 0,
[txtReturnCount]/[txtTotalResponses]*100)

This will return 0 if txtTotalResponses is 0 or Null.
 
Back
Top