Bizarre #error in query result

  • Thread starter ragtopcaddy via AccessMonster.com
  • Start date
R

ragtopcaddy via AccessMonster.com

I have the following three fields in a query:

test1: IIf(IsNull([Second KO - Treshold]),"None",[Second KO - Treshold])
test2: IIf(IsNull([First KO - Treshold]),"None",[First KO - Treshold])

test3: IIf(IsNull([Second KO - Treshold]),IIf(IsNull([First KO - Treshold]),
"None",[First KO - Treshold]),[Second KO - Treshold])

Test1 correctly returns "None"
Test2 correctly returns "None"
Test3, which is basically test1 with the True argument ("None") replaced by
test2's iif statement, returns #Error. Any idea why this might happen?

In case it's not obvious, what I'm trying to do is evaluate the 2 "Treshold"
fields (yes, I know it's misspelled, but that's what I've inherited) and if 1
has a value return it, otherwise, if 2 has a value return it. If neither has
a value, return "None". In this case, where neither field has a value, it
should return "None", But I'm getting this #Error.

Thanks,

Bill
 
J

John Spencer

I'm not seeing the cause. Try restating the expression

Test3: IIF([Second KO - Treshold] is Null and
[First KO Treshold] Is Null, "None",
NZ([First KO - Treshold], [Second KO - Treshold]))



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
R

ragtopcaddy via AccessMonster.com

Thanks a million John,

I used your rewrite. I suppose I'll never know what caused the error. Most
peculiar!

Bill

John said:
I'm not seeing the cause. Try restating the expression

Test3: IIF([Second KO - Treshold] is Null and
[First KO Treshold] Is Null, "None",
NZ([First KO - Treshold], [Second KO - Treshold]))

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
I have the following three fields in a query:
[quoted text clipped - 18 lines]
 

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