Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2013
    Posts
    14

    Query IIF Expression Help

    I have a very specific problem. I have a report where the following expression works great:
    =IIf([terminated]="-1","No",IIf([graduated?]="-1","No",IIf([dropped]="-1","No","Yes")))

    I now want to do this in a query and this expression throws an error:


    Active:=IIf([terminated]="-1","No",IIf([graduated?]="-1","No",IIf([dropped]="-1","No","Yes")))

    Can someone translate this into an expression that will work in a query?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You wouldn't want the = in the query. Also, this may be simpler:

    IIf([terminated]="-1" OR [graduated?]="-1" OR [dropped]="-1","No","Yes")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If [terminated] OR [graduated?] OR [dropped] are boolean (yes/no) fields, then should use -1 (no quotes) or TRUE (my preference).

    "-1" is a text string.

    For the query:
    Code:
    Active: IIf([terminated]= -1 OR [graduated?]= -1 OR [dropped]= -1,"No","Yes")
    (Yes, I copied Paul's expression )

    Also shouldn't use special characters or spaces in field names....>> [graduated?]

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

Similar Threads

  1. Query Expression Help
    By derek7467 in forum Queries
    Replies: 1
    Last Post: 08-02-2013, 01:12 PM
  2. Need help with Expression in Query
    By rookie77 in forum Queries
    Replies: 3
    Last Post: 11-30-2012, 07:17 AM
  3. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  4. Replies: 4
    Last Post: 10-26-2012, 12:49 AM
  5. Query Expression
    By nizam in forum Queries
    Replies: 1
    Last Post: 11-12-2011, 02:56 PM

Tags for this Thread

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