G
Guest
Hello! I have a query in which I am trying to use multiple nested IIf
statements to populate a new column based on other columns in my query
design. I have typed a select as Expression with nested IIf statements but I
am either getting a syntax error or missing closed parentheses error. Can
anyone tell me what is wrong with this:
Expr1: IIf([PL3]="20" Or "17",[P3],(IIf([PL2]="20" Or
"17",[P2]),(IIf([PL1]="20" Or "17",[P1])),(IIf([PL]="20" Or "17",[P],""))))
The SELECT as EXPRESSION should work like this for me:
Select column PL3 and if it = "20" or "17" then display the value of field P3
if not or null, then
Select column PL2 and if it = "20" or "17" then display the value of field P2
if not or null, then
Select column PL1 and if it = "20" or "17" then display the value of field P1
if not or null, then
Select column PL and if it = "20" or "17" then display the value of field P
Also, at anytime any of the fields may be NULL based on the parameter input
from the first query which this one is based upon. Am I headed in the right
direction with this? Thanks for any help!
statements to populate a new column based on other columns in my query
design. I have typed a select as Expression with nested IIf statements but I
am either getting a syntax error or missing closed parentheses error. Can
anyone tell me what is wrong with this:
Expr1: IIf([PL3]="20" Or "17",[P3],(IIf([PL2]="20" Or
"17",[P2]),(IIf([PL1]="20" Or "17",[P1])),(IIf([PL]="20" Or "17",[P],""))))
The SELECT as EXPRESSION should work like this for me:
Select column PL3 and if it = "20" or "17" then display the value of field P3
if not or null, then
Select column PL2 and if it = "20" or "17" then display the value of field P2
if not or null, then
Select column PL1 and if it = "20" or "17" then display the value of field P1
if not or null, then
Select column PL and if it = "20" or "17" then display the value of field P
Also, at anytime any of the fields may be NULL based on the parameter input
from the first query which this one is based upon. Am I headed in the right
direction with this? Thanks for any help!