A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

What's wrong with my IIF Statement?



 
 
Thread Tools Display Modes
  #11  
Old July 14th, 2008, 10:00 PM posted to microsoft.public.access.queries
raskew via AccessMonster.com
external usenet poster
 
Posts: 370
Default What's wrong with my IIF Statement?

You might also consider the Switch() function. Saves the problem of having
to match multiple parenthesis.

PressureSco Switch([Pressure]=80, 0,[Pressure]=100, 2,[Pressure]=120, 4,
[Pressure]=140, 6, True, 8)

PipeMaterialSco Switch([Pipe Material]="cast iron", 6,[Pipe Material]
="Ductile", 4,
[Pipe Material]="PVC" or [Pipe Material]="HDPE", 2,True, 0)

Bob

MB wrote:
I'm using this expression in my query and it works great:

PressureSco
IIf([Pressure]=80,"0",IIf([Pressure]=100,"2",IIf([Pressure]=120,"4",IIf([Pressure]=140,"6",IIf([Pressure]=141,"8")))))

However, the following is not working:

PipeMaterialSco IIf([Pipe Material]="cast iron","6",IIf([Pipe
Material]="Ductile","4",IIf([Pipe Mterial]="PVC" or "HDPE,"2","0"))

Should return scores as:

Cast Iron = 6
Ductile = 4
PVC = 2
HDPE = 2

Using Access 2007.


--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.