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

Does Immediate IIf statement have else clause

Status
Not open for further replies.

tdrBates

MIS
Nov 22, 2002
60
US
I'm trying to create a field that places different TP_NAME_1 in different SECTORS.

If TP_NAME_1 = "ARBORETUM" I can place it the Northwest Sector. However I would like to do this for several TP_NAME_1.

I've written the query below in MS Access QBE payne. How would I use an else clause or select case to place different TP_NAME_1 in different SECTORS?

Thanks for any help.

SELECT PCM.SURVEY_DATE, PCM.SURVEY_STATUS, PCM.TP_NAME_1, IIf([TP_NAME_1]="ARBORETUM","Northwest","") AS SECTOR, PCM.TOTAL_TRIPS, PCM.TRIPS_ONTIME, PCM.TRIPS_EARLY, PCM.TRIPS_LATE
FROM PCM
WHERE (((PCM.SURVEY_DATE) Between #12/1/2004# And #12/31/2004#) AND ((PCM.SURVEY_STATUS)=2));
 
Hi. Switch is likely your solution

Switch ([TP_NAME_1]="ARBORETUM","Northwest",
[TP_NAME_1]="Hello", "Something Else",
..... ) As Sector,

ChaZ


 
Also, if you have lots and lots, instead of a switch, consider putting them into a table, and joining them instead of calculating them.

ChaZ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top