Results 1 to 3 of 3
  1. #1
    Kellydp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    2

    query - field criteria (only open if you are patient) :)

    Help, I'm not a techie, but a couple years ago I created this query that is used in a report. A field in my query is this....

    classroom: IIf([Grade]=1 Or [Grade]=2 Or [Grade]=0 Or [Grade]=3,"K through 3rd","4th - 8th")



    And it gives me this.....As you can see, the students classrooms are divided by grade.

    Name classroom Grade
    Acosta, Isaac K through 3rd 3
    Acosta, Jacob K through 3rd 0
    Ashley, Austin K through 3rd 0
    Brown, Sierra K through 3rd 1
    Closson, Elijah K through 3rd 1
    Elliott, Amber K through 3rd 0
    Elliott, Brendan 4th - 8th 4
    Formentera, Abigail K through 3rd 3
    Garrett, William K through 3rd 3
    Godinez, Morgan K through 3rd 2
    Lauderdale, Erin K through 3rd 1
    Lewis, Sadie 4th - 8th 4

    Now I need to change it to add more classrooms - my language, not code.....if grade = 0, 1, or 2, then "K through 2nd" and if grade = 3 or 4 then "3rd and 4th" and the rest (5th - 8th) then "5th through 8th"

    Help, I can't figure out how to split this. I'd appreciate if someone could help. Thank you so very much!!!

  2. #2
    TheShabz is offline Court Jester
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2010
    Posts
    1,368
    All you need to do is imbed an iif into your iif. So something like:
    IIf([Grade]=1 Or [Grade]=2 Or [Grade]=0,"K through 2nd",iif([Grade]=3 Or [Grade]=4, "3rd and 4th","5th through 8th"))
    To explain that in english, what you do is
    If Grade = 0, 1, 2 Then K-2
    Otherwise check if Grade = 3, 4. If so, then 3rd and 4th.
    Else, 5th through 8th

  3. #3
    Kellydp is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    2
    Thank you so much. I had tried add the extra iif, but it didn't work for me, I probably didn't have enough )) at the end. It works great.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Different criteria for same field in same query
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 08-12-2011, 01:03 PM
  2. Replies: 6
    Last Post: 06-29-2010, 09:56 PM
  3. Patient Database
    By labadee in forum Database Design
    Replies: 1
    Last Post: 06-27-2010, 10:53 PM
  4. Query multiple field & criteria
    By fua in forum Access
    Replies: 2
    Last Post: 11-04-2009, 08:22 PM
  5. query - criteria based on another row field value
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 05-29-2009, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums