Results 1 to 4 of 4
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845

    Operand without an operator error

    Test: IIf([Level]="Level 3 Cat II" Or [Soft Level]="Level 3 Cat II" And [HR]<>0,“GO OOB in Progress”,"Nope")



    I get this error on the OOB part of the code. I thought this was a simple IIF(Condition, True Statement, False Statement) code.

    Any suggestions?

    Thanks

  2. #2
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    Figured it out, it was in the " (Text) and “ (Word).


  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    Be careful when mixing OR and AND operators. Parens can be critical. Maybe should be:

    IIf(([Level]="Level 3 Cat II" Or [Soft Level]="Level 3 Cat II") And [HR]<>0,

    or

    IIf([Level]="Level 3 Cat II" Or ([Soft Level]="Level 3 Cat II" And [HR]<>0),

    Without parens I think the first structure will be invoked.

    And this would be very different output:

    IIf([HR]<> 0 AND [Level]="Level 3 Cat II" Or [Soft Level]="Level 3 Cat II",
    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.

  4. #4
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    845
    Thanks June7, Fortunately I already picked up on it when I added a True/False control and it wouldn't recognize. Added () around the OR controls and then it worked.

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

Similar Threads

  1. Replies: 2
    Last Post: 09-10-2014, 11:30 AM
  2. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  3. Operand without operator or
    By burrina in forum Queries
    Replies: 2
    Last Post: 12-31-2012, 06:14 PM
  4. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  5. Replies: 5
    Last Post: 03-27-2012, 01:40 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