Multiple conditions in an IIF statement

G

Guest

Hi Everyone - need some help and you guys are ALWAYS coming to my rescue!!!

OK - i have a query with an Expression that right now is as follows:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE,
[Exp","Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Where if the field says "Undeliverable, [Exp", it returns something else. I
actually have two additional conditions that, if found, the query needs to
return the same result. More specifically, in addition to the "Undeliverable,
[Exp" value, if "HURRICANE, [Expires" or "HIGH_VALUE_CARD, [Ex" is in the
field, I need the query to return the same result - "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Right now I am trying an Or condition in the middle where it reads:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE, [Exp" Or
"HURRICANE, [Expires", "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

And now it is returning the same result for anything that is in the field -
this isn't right. I tried writing two separate IIf statements with just an Or
separator and it told me I had two many arguements.....

Can someone help me out? I would appreciate!!!

Thanks so much in advance.....
Victoria
 
G

Guest

Those square brackets in the data are crossing my eyes! That usually is a
field delimiter, so it is a bit confusing. It appears the problem is you are
not identifying your compare statement correctly.
You can't use
Iif([SomeField] = "X" or "Y",...
It has to be
Iif([SomeField] = "X" or [SomeField] = "Y",...
or even better
Iif([SomeField] IN ("X", "Y"),...

So try:

Expr1: IIf([CurrentWeek]![Original_SVS_ID] IN("UNDELIVERABLE, [Exp",
"HURRICANE, [Expires"), "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])
 
G

Guest

Absolutely hysterical! My apologies for the eye-crossing experience!

As usual, this worked PERFECTLY!!! I don't know how you do what you do, but
it is a beautiful thing!

Have an amazing day/weekend!!! Office Depot (Corporate) thanks you!!!

Victoria

Klatuu said:
Those square brackets in the data are crossing my eyes! That usually is a
field delimiter, so it is a bit confusing. It appears the problem is you are
not identifying your compare statement correctly.
You can't use
Iif([SomeField] = "X" or "Y",...
It has to be
Iif([SomeField] = "X" or [SomeField] = "Y",...
or even better
Iif([SomeField] IN ("X", "Y"),...

So try:

Expr1: IIf([CurrentWeek]![Original_SVS_ID] IN("UNDELIVERABLE, [Exp",
"HURRICANE, [Expires"), "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])


Victoria1366 said:
Hi Everyone - need some help and you guys are ALWAYS coming to my rescue!!!

OK - i have a query with an Expression that right now is as follows:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE,
[Exp","Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Where if the field says "Undeliverable, [Exp", it returns something else. I
actually have two additional conditions that, if found, the query needs to
return the same result. More specifically, in addition to the "Undeliverable,
[Exp" value, if "HURRICANE, [Expires" or "HIGH_VALUE_CARD, [Ex" is in the
field, I need the query to return the same result - "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Right now I am trying an Or condition in the middle where it reads:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE, [Exp" Or
"HURRICANE, [Expires", "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

And now it is returning the same result for anything that is in the field -
this isn't right. I tried writing two separate IIf statements with just an Or
separator and it told me I had two many arguements.....

Can someone help me out? I would appreciate!!!

Thanks so much in advance.....
Victoria
 
G

Guest

Are you in Dallas?

Victoria1366 said:
Absolutely hysterical! My apologies for the eye-crossing experience!

As usual, this worked PERFECTLY!!! I don't know how you do what you do, but
it is a beautiful thing!

Have an amazing day/weekend!!! Office Depot (Corporate) thanks you!!!

Victoria

Klatuu said:
Those square brackets in the data are crossing my eyes! That usually is a
field delimiter, so it is a bit confusing. It appears the problem is you are
not identifying your compare statement correctly.
You can't use
Iif([SomeField] = "X" or "Y",...
It has to be
Iif([SomeField] = "X" or [SomeField] = "Y",...
or even better
Iif([SomeField] IN ("X", "Y"),...

So try:

Expr1: IIf([CurrentWeek]![Original_SVS_ID] IN("UNDELIVERABLE, [Exp",
"HURRICANE, [Expires"), "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])


Victoria1366 said:
Hi Everyone - need some help and you guys are ALWAYS coming to my rescue!!!

OK - i have a query with an Expression that right now is as follows:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE,
[Exp","Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Where if the field says "Undeliverable, [Exp", it returns something else. I
actually have two additional conditions that, if found, the query needs to
return the same result. More specifically, in addition to the "Undeliverable,
[Exp" value, if "HURRICANE, [Expires" or "HIGH_VALUE_CARD, [Ex" is in the
field, I need the query to return the same result - "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Right now I am trying an Or condition in the middle where it reads:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE, [Exp" Or
"HURRICANE, [Expires", "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

And now it is returning the same result for anything that is in the field -
this isn't right. I tried writing two separate IIf statements with just an Or
separator and it told me I had two many arguements.....

Can someone help me out? I would appreciate!!!

Thanks so much in advance.....
Victoria
 
G

Guest

No - Florida (Palm Beach County) - why - where are you?

Klatuu said:
Are you in Dallas?

Victoria1366 said:
Absolutely hysterical! My apologies for the eye-crossing experience!

As usual, this worked PERFECTLY!!! I don't know how you do what you do, but
it is a beautiful thing!

Have an amazing day/weekend!!! Office Depot (Corporate) thanks you!!!

Victoria

Klatuu said:
Those square brackets in the data are crossing my eyes! That usually is a
field delimiter, so it is a bit confusing. It appears the problem is you are
not identifying your compare statement correctly.
You can't use
Iif([SomeField] = "X" or "Y",...
It has to be
Iif([SomeField] = "X" or [SomeField] = "Y",...
or even better
Iif([SomeField] IN ("X", "Y"),...

So try:

Expr1: IIf([CurrentWeek]![Original_SVS_ID] IN("UNDELIVERABLE, [Exp",
"HURRICANE, [Expires"), "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])


:

Hi Everyone - need some help and you guys are ALWAYS coming to my rescue!!!

OK - i have a query with an Expression that right now is as follows:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE,
[Exp","Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Where if the field says "Undeliverable, [Exp", it returns something else. I
actually have two additional conditions that, if found, the query needs to
return the same result. More specifically, in addition to the "Undeliverable,
[Exp" value, if "HURRICANE, [Expires" or "HIGH_VALUE_CARD, [Ex" is in the
field, I need the query to return the same result - "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Right now I am trying an Or condition in the middle where it reads:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE, [Exp" Or
"HURRICANE, [Expires", "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

And now it is returning the same result for anything that is in the field -
this isn't right. I tried writing two separate IIf statements with just an Or
separator and it told me I had two many arguements.....

Can someone help me out? I would appreciate!!!

Thanks so much in advance.....
Victoria
 
G

Guest

Fort Worth, Texas. I thought there were some Office Depot offices here, In
Arlington, I thought. Maybe it is a regional thing.

Victoria1366 said:
No - Florida (Palm Beach County) - why - where are you?

Klatuu said:
Are you in Dallas?

Victoria1366 said:
Absolutely hysterical! My apologies for the eye-crossing experience!

As usual, this worked PERFECTLY!!! I don't know how you do what you do, but
it is a beautiful thing!

Have an amazing day/weekend!!! Office Depot (Corporate) thanks you!!!

Victoria

:

Those square brackets in the data are crossing my eyes! That usually is a
field delimiter, so it is a bit confusing. It appears the problem is you are
not identifying your compare statement correctly.
You can't use
Iif([SomeField] = "X" or "Y",...
It has to be
Iif([SomeField] = "X" or [SomeField] = "Y",...
or even better
Iif([SomeField] IN ("X", "Y"),...

So try:

Expr1: IIf([CurrentWeek]![Original_SVS_ID] IN("UNDELIVERABLE, [Exp",
"HURRICANE, [Expires"), "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])


:

Hi Everyone - need some help and you guys are ALWAYS coming to my rescue!!!

OK - i have a query with an Expression that right now is as follows:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE,
[Exp","Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Where if the field says "Undeliverable, [Exp", it returns something else. I
actually have two additional conditions that, if found, the query needs to
return the same result. More specifically, in addition to the "Undeliverable,
[Exp" value, if "HURRICANE, [Expires" or "HIGH_VALUE_CARD, [Ex" is in the
field, I need the query to return the same result - "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

Right now I am trying an Or condition in the middle where it reads:

Expr1: IIf([CurrentWeek]![Original_SVS_ID]="UNDELIVERABLE, [Exp" Or
"HURRICANE, [Expires", "Undeliverable - " &
[CurrentWeek]![Reward_Period],[CurrentWeek]![Reason] & " - " &
[CurrentWeek]![Reward_Period])

And now it is returning the same result for anything that is in the field -
this isn't right. I tried writing two separate IIf statements with just an Or
separator and it told me I had two many arguements.....

Can someone help me out? I would appreciate!!!

Thanks so much in advance.....
Victoria
 

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