#Error, #Div/0! in controls

  • Thread starter Thread starter jer
  • Start date Start date
J

jer

I have included controls in a form (datasheet view) that
give the result of calculations of other controls in the
form e.g. "datesold" and "dateprocessed" are 2 controls
and "elapseddays" is another controls that shows the
difference between "dateprocessed" and "datesold". The
unique key is an autonumber. The controls work fine
except that #Error or #Div/0! appear in the form. Is
there a way to hide these
TIA
jer
 
They are probably showing up when the fields supplying data for the equation
are Null or the one used for the denominator is zero. The Null can be
handled with an IIF or Nz function, the divide by zero can be handled with
an IIF function.

Example:
=IIf(txtDenominator = 0, 0, txtNumerator / txtDenominator)
=IIf(IsNull(txtMyTextbox), "", txtMyTextbox + 1)
=Nz(txtMyTextbox, "")
 
Thanks Wayne
jer
-----Original Message-----
They are probably showing up when the fields supplying data for the equation
are Null or the one used for the denominator is zero. The Null can be
handled with an IIF or Nz function, the divide by zero can be handled with
an IIF function.

Example:
=IIf(txtDenominator = 0, 0, txtNumerator / txtDenominator)
=IIf(IsNull(txtMyTextbox), "", txtMyTextbox + 1)
=Nz(txtMyTextbox, "")

--
Wayne Morgan





.
 
Back
Top