Results 1 to 6 of 6
  1. #1
    Reigncloud is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Feb 2012
    Posts
    2

    IIF query using OR operators not working

    I'm trying to run the following as criteria in an MS access query. Basically what I want to do is:


    • If checkbox = True then all records, including those with blank or Null fields are shown (the default value in my form's combo box [combo9] is "*")
    • If checkbox = False then only records that match the value in Combo9 are shown


    My current expression doesn't give any errors, but also doesn't produce any results! The TRUE and FALSE halves of the expression work fine on their own, but don't work when combined into the iif expression.

    Like IIf([Forms]![F_leg_reg]![Check25]=True,Like [Forms]![F_leg_reg]![Combo9] Or "" Or Is Null,Like [Forms]![F_leg_reg]![Combo9])



    Can someone please tell me what I'm doing wrong here? Thanks in advance.

  2. #2
    Aragan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    22
    Quote Originally Posted by Reigncloud View Post

    Like IIf([Forms]![F_leg_reg]![Check25]=True,Like [Forms]![F_leg_reg]![Combo9] Or "" Or Is Null,Like [Forms]![F_leg_reg]![Combo9])

    Can someone please tell me what I'm doing wrong here? Thanks in advance.
    U r making a mistake in the Iif arguments, it should be (expr, value if true, value if false)

  3. #3
    Reigncloud is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Feb 2012
    Posts
    2
    Yes, I know it's a mistake. Any specific help to rectify it would be appreicated!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Please show the entire code.

  5. #5
    Aragan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    22
    Be more specific... if teh field is true then all the records are shown... but where??? in a subform?? in a query called when a button is pressed?

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Show the sql for the query.

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

Similar Threads

  1. Help please! iif not working in query!
    By ham355 in forum Queries
    Replies: 4
    Last Post: 02-16-2012, 05:05 AM
  2. Parameter Query not working
    By cphelps48 in forum Queries
    Replies: 3
    Last Post: 10-06-2011, 04:42 PM
  3. List box with operators
    By akingsley in forum Programming
    Replies: 8
    Last Post: 11-06-2010, 05:59 PM
  4. Adding Mathematical Operators to my QBF
    By Silver Rain 007 in forum Queries
    Replies: 1
    Last Post: 11-05-2009, 08:54 AM
  5. Query is not working
    By pushpm in forum Programming
    Replies: 3
    Last Post: 04-14-2009, 07:16 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