Results 1 to 8 of 8
  1. #1
    ragsgold is offline Access & Excel Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2009
    Location
    Denver,CO
    Posts
    51

    Post iif statement with multiple conditions


    Hi I am looking in for a iif statement usage mutiple parametres i am doing this in the expression bulder in the queries and trying to put the below argument in a seperate colum with iif statements.

    i have a "Sales" colum which has data A,B,C,D,E,F

    now my argument is if Sales= "A" or "B" the result should be EUR and if sales ="C" or "D" then result should be AMR and finally if Sales = "E" or "F" the result should "PAC"...

    can someone help me in this thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    To make it easier to maintain and read, why not create a public function in a standard module that uses a Case statement?

  3. #3
    ragsgold is offline Access & Excel Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2009
    Location
    Denver,CO
    Posts
    51
    I am actually new to modules and hence i am trying out this in query i wrote a expression like iif(sales ="eu01" or "eu02","Europe",iif(sales="am01" or am02","AMR",iif(sales="jp01" or "kr01","Pac"))),0) here all these in quotes like eu01,eu02 etc are in the colum sales ...is my statement fine i dont get any error but my result is Europe for all codes!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You have to repeat the field each time like:
    [sales] = "eu01" OR [sales] = "eu02","Europe"
    ...etc

  5. #5
    ragsgold is offline Access & Excel Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2009
    Location
    Denver,CO
    Posts
    51
    Hi Ruralguy thanks a lot your solution worked

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad I could help.

  7. #7
    langit233 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    1
    hi RURALGUY!i need to create also a privilege like to change the password of my users actually i set a user password using visual basic but i want to give them as i have said above, a privilege to change there password with a form please help me! a great help would be very highly appreciated! thanks!nyways, im attaching my access 2007 file here so its up to you to explore that file and hoping to get back to you peepz soon with the answer of my needs.thanks so much!

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Please start a new thread and show a link to this thread if you believe it will be useful.

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

Similar Threads

  1. IIF statement
    By james1982 in forum Access
    Replies: 1
    Last Post: 07-20-2009, 09:38 AM
  2. Query on multipl conditions.
    By Goldenbird in forum Queries
    Replies: 0
    Last Post: 06-28-2009, 11:45 PM
  3. Expression with multiple conditions
    By techexpressinc in forum Queries
    Replies: 3
    Last Post: 06-19-2009, 08:33 PM
  4. Iff Statement Meeting 2 Conditions
    By newbie in forum Access
    Replies: 11
    Last Post: 06-11-2009, 11:59 AM
  5. multiple iif statement NEED HELP PLZ
    By scott munkirs in forum Reports
    Replies: 1
    Last Post: 09-27-2006, 05:21 AM

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