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!

IIf statement

Status
Not open for further replies.

aginter

Technical User
Aug 29, 2002
6
US
With this IIf statement I'm not getting a result for the last field. It's the If position is "N" then "Not Reported".I'm getting #Error.


=IIf([Position]=1,"Officers/Managers",IIf([Position]=2,"Professional",IIf([Position]=3,"Technician",IIf([Position]=4,"Sales Workers",IIf([Position]=5,"Office/Clerical",IIf([Position]=6,"Craftsmen",IIf([Position]=7,"Operatives-Semi-Skilled",IIf([Position]=8,"Labor Unskilled",IIf([Position]=9,"Service Workers",IIf([Position]="N","Not Reported"))))))))))
 
aginter,
You might want to check Help, looking at the Choose() function or the Switch() function, one of these might be less cumbersome for your statement.

Alternatively, if the above statement *must* be inline, and if it gets more complex, you might want to consider writing your own function with the vertical logic, then call that function from the query Column field, passing the [position] field.
--Jim
 
I solved this issue, I need to put the "N" IIf statement first then followed by the rest! It worked.

Thanks,
Any how
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top