CALCULATED FIELDS

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!
 
R

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*" ...
 
G

Guest

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*" ...
 

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