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

conditional field

Status
Not open for further replies.

cluser

Technical User
Jun 19, 2005
38
US
Hello, I would like to have a field display in my report.

called UserID, If the students are grade k, 1, 2, I want it to be lunchcode, if they are grade 3-12, I want it to be students ID.
it seems iif can only has two cases.
How can I do this, what code and where should I add ?

Thanks
 
Looks like you only need two cases?

UserID: iif(Grade = "k" or Grade = "1" or Grade = "2",[LunchCode],[StudentID])

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Thanks, it solves my problem, but just curious, if more than 2 conditions, what will I do?

Thanks
 
Embedded IIF's:

iif(X=1,"ONE",iif(X=2,"TWO",iif(X=3,"THREE","FOUR")))

So that reads:
If X = 1 THEN
Answer = "ONE"
ELSE
If X = 2 THEN
Answer = "TWO"
ELSE
If X = 3 then
Answer = "THREE"
ELSE
Answer = "FOUR"
END IF
END IF
END IF

Does that help?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top