Nested Queries Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello -

I have a single field and wish to create a query which categorizes the items
in the field. So if within the field, there is "AA', then return "Apples, if
not, look for "BB", if so then return "Balls", if not...

Below is the code:
Items: IIf(InStr(
![Field],"AA")>0,"Apples",IIf(InStr(
![
Field],"BB")>0,"Balls", IIf(InStr(
![ Field],"CC")>0,"Cats",
IIf(InStr(
![ Field],"DD")>0,"Dogs","Don’t Know"))))

For some reason, if it does not see "AA", I am only getting "Don't Know". It
does not seem to read the other if statements.

Please please help!
 
In all other cases you have a space before " Field" name, try

Items:
IIf(InStr(
![Field],"AA")>0,"Apples",IIf(InStr(
![Field],"BB")>0,"Balls", IIf(InStr(
![Field],"CC")>0,"Cats",
IIf(InStr(
![Field],"DD")>0,"Dogs","Don’t Know"))))
 
Back
Top