Results 1 to 4 of 4
  1. #1
    GeorgeB is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    18

    Question using IIF with And and Or

    Hello



    I searched a lot and I couldn't find what I am looking for

    I am trying to combine IIF function with And and Or and I started my first query but it doesn't work and I can't figure out why

    if you can please help me or provide some links to help with having many conditions in iif

    I am still new and only use the code builder no idea on SQL


    Case1: IIf(([CountOfORDER_NUMBER]=1) And (([CPU_TYPE]="*sae*") Or ([CPU_TYPE]="*preliminary*")) And (([WO_STATUS]="dlp" or [WO_STATUS]="fc")),"N","")


    Thanks very much



    Additional info :

    What I want to is

    if [CountOfORDER_NUMBER]=1
    And [CPU_TYPE]="*sae*" OR = "*Pre*"
    And [WO_STATUS]="dlp" or "fc"

    I just get any indicator otherwise I don't care

    but that's the first and easiest case

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Quote Originally Posted by GeorgeB View Post
    And [CPU_TYPE]="*sae*" OR = "*Pre*"
    Do you have [CPU_TYPE] values stored the way you have shown i.e. *sae*, *Pre* or are you trying to find values similar to sae or Pre.

    If you are trying to find similar values, try
    Code:
    ..........
    And 
    (
        [CPU_TYPE] LIKE "*sae*" 
        Or 
         [CPU_TYPE] LIKE "*pre*"
    ) 
    And  
    .............
    Thanks

  3. #3
    GeorgeB is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2012
    Posts
    18
    you are a legend

    Thanks very much

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Glad you found it helpful.
    In case you have not seen this, just take a look :
    http://office.microsoft.com/en-us/ac...001032253.aspx

    Thanks

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

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