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!

Expression to return different values

Status
Not open for further replies.

ps32208

Technical User
Jul 29, 2005
42
EU
Hi,

I need to create an expression in an MS Access query to return values depending on the data in other fields, easy to achieve with IF statements in XL but new ball game in Access...

I need to achieve the following expression in a query:

If field 'Stage' has the word "Won" in part of it then return "Won" if not then if field 'Committed' = Y then return "committed" and if not then if field "Probability" >=50 then return "up" and if not then if field 'probability' <50 then return "WIP"

Any help on this is most greatfully received.

 
You can use IIf in Access queries:

[tt]IIf(Instr([Stage],"Won")>0,"Won",IIf([Committed]=True,"Committed",IIf([Probability]>=50,"Up","WIP")))[/tt]


Assuming that Committed is Boolean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top