Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF statement giving me a fit

Status
Not open for further replies.

kalebson

Programmer
Mar 3, 2006
60
US
I am trying to get this statement to calculate based on 3 parameters:

CallsAbandoned1: IIf([dbo_dApplicationStat_PHX].[Application]<>"DI_CF_App" Or "DI_IBank_App" Or "DI_Met_App",(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10]))),(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10])+([AbdDelay12])+([AbdDelay14])+([AbdDelay16])+([AbdDelay18])+([AbdDelay20])))

However I get the same result that I get w/o the

(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10])+([AbdDelay12])+([AbdDelay14])+([AbdDelay16])+([AbdDelay18])+([AbdDelay20])))

Am I missing a comma or parenthesis in the wrong place? TIA.

 
Replace this:
([dbo_dApplicationStat_PHX].[Application]<>"DI_CF_App" Or "DI_IBank_App" Or "DI_Met_App",
with either this:
([dbo_dApplicationStat_PHX].[Application] Not In ("DI_CF_App","DI_IBank_App","DI_Met_App"),
or this:
([dbo_dApplicationStat_PHX].[Application]<>"DI_CF_App" Or [dbo_dApplicationStat_PHX].[Application]<>"DI_IBank_App" Or [dbo_dApplicationStat_PHX].[Application]<>"DI_Met_App",

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Try the NOT IN statement instead of stringing together ORs

CallsAbandoned1: IIf([dbo_dApplicationStat_PHX].[Application] NOT IN("DI_CF_App","DI_IBank_App", "DI_Met_App"),
(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10]))),(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10])+([AbdDelay12])+([AbdDelay14])+([AbdDelay16])+([AbdDelay18])+([AbdDelay20])))

If you want to string together ORs the syntax will be:

CallsAbandoned1: IIf([dbo_dApplicationStat_PHX].[Application]<>"DI_CF_App" Or [dbo_dApplicationStat_PHX].[Application]<>"DI_IBank_App" Or [dbo_dApplicationStat_PHX].[Application]<>"DI_Met_App",(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10]))),(([dbo_dApplicationStat_PHX].[CallsAbandoned])-(([AbdDelay2])+([AbdDelay4])+([AbdDelay6])+([AbdDelay8])+([AbdDelay10])+([AbdDelay12])+([AbdDelay14])+([AbdDelay16])+([AbdDelay18])+([AbdDelay20])))

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases:
The Fundamentals of Relational Database Design
Understanding SQL Joi
 
OOps, wrong logic:
or this:
([dbo_dApplicationStat_PHX].[Application]<>"DI_CF_App" And [dbo_dApplicationStat_PHX].[Application]<>"DI_IBank_App" And [dbo_dApplicationStat_PHX].[Application]<>"DI_Met_App",

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Of course I'm not sure what you want your IF statement to be, but this is what it is:

If Application is unequal to DI_CF_APP
OR
If DI_IBank_App is True
OR
If DI_Met_App is True,

Then ...

I will assume that you want to check DI_CF_APP AND DI_Bank_App AND DI_Met_App against Application. And, if you want each of them to be UNEQUAL to Application, then you will need AND between each test for UNEQUAL. With the AND, you are making sure that ALL three comparisons to Application are UNEQUAL.

If I have guessed wrong about your IF, let me know and I will look further.

HTH,
Vic
 
I even screen shotted this post cuz I know im gonna do it again later hehe..thx again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top