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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIf Statement - Above 55 = AT = 40-54 = OT and Below 39 = BT 2

Status
Not open for further replies.

lmn

Programmer
Apr 3, 2003
60
US
Why is this statement wrong? :(

Expr1: IIf([Score]>=55,&quot;AT&quot;,&quot;&quot;) Or ([Score] Between 40 And 54,&quot;OT&quot;,&quot;&quot;) Or ([Score]<40,&quot;BT&quot;,&quot;&quot;)


I'm trying - in one column - to determine if a score is Above Target, On Target or Below Target. I thought this would work....

Any suggestions on what I'm doing wrong?

 
They must be nested

Expr1: IIf([Score]>=55,&quot;AT&quot;,&quot;&quot;) Or ([Score] Between 40 And 54,&quot;OT&quot;,&quot;&quot;) Or ([Score]<40,&quot;BT&quot;,&quot;&quot;)

Try this solution


Expr1: IIf([Score]>=55,&quot;AT&quot;,IIF([Score] Between 40 And 54,&quot;OT&quot;,IIF([Score]<40,&quot;BT&quot;,&quot;&quot;)))
 
Genius - thanks.

If I knew how to give stars I'd give you one (and the Trendsetter dude who has helped me out of many a pickle)......

 
Here's a perhaps easier way to handle this kind of thing:

MyScore: Switch( Score >= 55, &quot;Above Target&quot;, Score < 40 , &quot;Below Target&quot;, True, &quot;On Target&quot;)


I have an aversion to nested IFs - unless you like spaghetti.

JMH


Me? Ambivalent? Well, yes and no....
Another free Access forum:
More Access stuff at
 
To give stars, click on

Mark this post as a helpful/expert
post
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top