CALCULATED FIELDS

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have entered the following expression in order to create a calculated field
in a query:
Expr1: IIf([ITEM CODE] Like "19*" Or "24*" Or "14*" Or "33*" Or "27*" Or
"37*" Or "20*D";25;(IIf([ITEM CODE] Like "39*";30;(IIf(ITEM CODE] Like "*R"
Or "29*";35;(IIf([ITEM CODE] Like "23*";20;Null)))))))

(ITEM CODE=unique numeric code of our inventory)

problem statement: the calculated field returns the value 25 for all fields
item codes ignoring the criteria i have set. what am i doing wrong?

pls help me!
 
angie said:
i have entered the following expression in order to create a
calculated field in a query:
Expr1: IIf([ITEM CODE] Like "19*" Or "24*" Or "14*" Or "33*" Or "27*"
Or "37*" Or "20*D";25;(IIf([ITEM CODE] Like "39*";30;(IIf(ITEM CODE]
Like "*R" Or "29*";35;(IIf([ITEM CODE] Like "23*";20;Null)))))))

(ITEM CODE=unique numeric code of our inventory)

problem statement: the calculated field returns the value 25 for all
fields item codes ignoring the criteria i have set. what am i doing
wrong?

pls help me!

This might not solve everything but your OR stuff is wrong. You can't
use...

IIf([ITEM CODE] Like "19*" Or "24*" ...

You have to repeat the field each time like...

IIf([ITEM CODE] Like "19*" Or [ITEM CODE] Like "24*" ...
 
this solved the problem.

thank you!

Ο χÏήστης "Rick Brandt" έγγÏαψε:
angie said:
i have entered the following expression in order to create a
calculated field in a query:
Expr1: IIf([ITEM CODE] Like "19*" Or "24*" Or "14*" Or "33*" Or "27*"
Or "37*" Or "20*D";25;(IIf([ITEM CODE] Like "39*";30;(IIf(ITEM CODE]
Like "*R" Or "29*";35;(IIf([ITEM CODE] Like "23*";20;Null)))))))

(ITEM CODE=unique numeric code of our inventory)

problem statement: the calculated field returns the value 25 for all
fields item codes ignoring the criteria i have set. what am i doing
wrong?

pls help me!

This might not solve everything but your OR stuff is wrong. You can't
use...

IIf([ITEM CODE] Like "19*" Or "24*" ...

You have to repeat the field each time like...

IIf([ITEM CODE] Like "19*" Or [ITEM CODE] Like "24*" ...
 
Back
Top