#Error on form

  • Thread starter Thread starter CS
  • Start date Start date
C

CS

I have a calculated field on a form that requires input
from another field to perform the calculation. If the
input is blank, the calculated field shows #Error. Is
there a way to just have it stay blank if the input field
does not have data?
 
It's a matter of finding out what caused the error.

Take this example:
=DLookup("ID", "MyTable", "SomeNumberField = " & [SomeControl])

If SomeControl is Null, the 3rd argument becomes just:
SomeNumberField =
which is a nonsense, and generates the #Error. To avoid that situation, use
Nz() to supply some numeric value, e.g.:
=DLookup("ID", "MyTable", "SomeNumberField = " & Nz([SomeControl],0))
 
Hi CS,
try this in your calculated field:
=IIF(isnull(sourcefield),"",calculation)

Hope this works for you
 
Thanks hcj and Allen. Looks like this will work.
-----Original Message-----
Hi CS,
try this in your calculated field:
=IIF(isnull(sourcefield),"",calculation)

Hope this works for you

.
 
Back
Top