What's the problem here.

  • Thread starter Thread starter jlepack
  • Start date Start date
J

jlepack

flag1:iif(ht,iif(avg>t,iif(hu,iif(avg>u,3,2),1),iif(avg<t,iif(hl,iif(avg<l,3,2),1),1),0)

I put the above statement in the field of my query. This statment is
supposed to determine whether the value "avg" is on target, within
control, or out of control.

ht = has target
hu = has upper threshold
hl = has lower threshold
t = target value
u = upper threshold value
l = lower threshold value

3 = out of control
2 = within control
1 = on target
0 = not measured (no target)

When I execute the statement it tells me that the function has the
wrong number of arguments. Why is this?
 
jlepack said:
flag1:iif(ht,iif(avg>t,iif(hu,iif(avg>u,3,2),1),iif(avg<t,iif(hl,iif(avg<l,3,2),1),1),0)

I put the above statement in the field of my query. This statment is
supposed to determine whether the value "avg" is on target, within
control, or out of control.

ht = has target
hu = has upper threshold
hl = has lower threshold
t = target value
u = upper threshold value
l = lower threshold value

3 = out of control
2 = within control
1 = on target
0 = not measured (no target)

When I execute the statement it tells me that the function has the
wrong number of arguments. Why is this?


Break it down and count the parenthesis.

This tells me, you are missing the false part of the first
or second iif:

iif(ht,
iif(avg>t,
iif(hu,
iif(avg>u,3,2),
1),
iif(avg<t,
iif(hl,
iif(avg<l,3,2),
1),
1),
0)
 
avg is an access reserved word Avg() function.
[avg] may work, but you should not use it as a field name.
 
Back
Top