Results 1 to 4 of 4
  1. #1
    tennisbuck is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2012
    Posts
    51

    IFF OR Statement

    Hello,


    How do you write a iff/OR statement in access? For example:

    · In the bucket, check if the L5,L6 and L7 taxonomy codes match. ** If the field is null it is ok. Throw out exceptions with a status “codes mismatch”

    o [e.g. Mfg name mfg Num L5 L6 l7

    § Ford 100 2000 3000 4000

    § Ford 100 2000 - -



    So basically columns L5, L6, L7 have to equal each other or be NULL. If it doesn't meet this condition it would be false.



    This example would be true.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Will L5 always have value?

    Try:

    IIf(L5=Nz(L6,L5) AND L5=Nz(L7,L5), "Equal", Null)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tennisbuck is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Jun 2012
    Posts
    51
    Actually L5 might be zero also.

    So here how it would need to work

    So these are the values L5, L6 and L7

    1000, 1000, 1000

    1000, null, 1000
    null, 1000, 1000
    null, null, 1000


    1000, 1000, null.

    Everything else false that says code mismatch
    Last edited by June7; 05-15-2014 at 10:37 AM.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    You mean it might be Null?

    Try this:

    SELECT *
    FROM tablename
    WHERE (((IIf(Nz([L5],Nz([L6],Nz([L7],1)))=Nz([L6],Nz([L5],Nz([L7],1))) And Nz([L5],Nz([L6],Nz([L7],1)))=Nz([L7],Nz([L5],Nz([L6],1))), "Equal", Null)) = "Equal"));
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Need help with IIF statement
    By mommyof4kids in forum Forms
    Replies: 11
    Last Post: 06-21-2013, 08:10 AM
  2. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  3. Replies: 7
    Last Post: 08-17-2011, 01:49 PM
  4. BETWEEN in a FROM Statement
    By Cyborg in forum Queries
    Replies: 6
    Last Post: 05-12-2011, 01:54 PM
  5. Need Help with SQL Statement
    By Hank44 in forum Programming
    Replies: 3
    Last Post: 11-08-2010, 05:49 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