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

IIf Statement

Status
Not open for further replies.

Doc94

Technical User
Joined
Aug 1, 2003
Messages
58
Location
US
I have the following SQL statement in a query:

IIf([Detail]![DispositionCode]=41,1) AS Admitted

Where 41 is the admitted disposition code. I would like for it to say if it is 41 or 31 or 12, 1 as admitted but I can not come up with the correct syntax.
And I need to use this because in the same query I have the SQL statement:

IIf([Detail]![DispositionCode]=1,2) AS Discharged

I will then be counting the 1's which will give me the Admitted and the 2's that will give me the discharges for a report based on this query.
Any help would be appreciated.
 
Use the ElseIF position to insert the second test. Repeat for each case.

IIf([Detail]![DispositionCode]=41,1,[Detail]![DispositionCode]=31,1)) AS Admitted

 
Thanks Mark. I tried that and it works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top