#Error on form

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?
 
A

Allen Browne

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))
 
H

hcj

Hi CS,
try this in your calculated field:
=IIF(isnull(sourcefield),"",calculation)

Hope this works for you
 
C

CS

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

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top