The only real solution is to find out what's causing the error, and deal
with that.
For example, if you have:
[Field1] / [Field2]
that will give an error if Field2 is zero. Therefore you need:
IIf([Field2]=0, Null, [Field1] / [Field2])
Similarly, if you have:
DLookup("CompanyName", "tblCompany", "CompanyID = " & [CompanyID])
when CompanyID is null (e.g. in the new record row), the 3rd expression
becomes just:
CompanyID =
which is incomplete and will give an error. To handle that, use:
DLookup("CompanyName", "tblCompany", "CompanyID = " & Nz([CompanyID],0))
In essence, understand what caused the error, and fix the problem.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
Barry said:
I'm running a query that returns #Error for some rows. I tried to run
iif(iserror([field]),1,0) but it still returns #Error. I have also tried
isnull, isempty, ismissing. and iif([field]="#Error",1,0). I would
appreciate any ideas.