Results 1 to 4 of 4
  1. #1
    BoesFarmers is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2

    Multiple IIF statements returning -1 instead of 1


    When I try to run two iif statements between fields I get a -1 instead of 1. The statements work fine by themselves.

    Inactive and Opted-in 2: IIf([enrollment status 2012] Is Null And [enrollment status 2013]="opt-in","1",Null) Or IIf([enrollment status 2012]="opt-out" And [enrollment status 2013]="opt-in","1",Null)

  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,641
    I suspect you want:

    Inactive and Opted-in 2: IIf(([enrollment status 2012] Is Null Or [enrollment status 2012]="opt-out") And [enrollment status 2013]="opt-in","1",Null)

    FYI, spaces and symbols in object names are not worth it in the long run.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    BoesFarmers is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2
    @pbaldy - Thanks. That appears to work. I appreciate the suggestion on spaces and symbols in the object names and will keep that in mind for future builds.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problem. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. How to use multiple IIf statements in a query
    By jabadoojr in forum Queries
    Replies: 4
    Last Post: 12-17-2012, 11:05 AM
  2. Multiple iif statements
    By rlsublime in forum Queries
    Replies: 3
    Last Post: 04-25-2012, 10:33 AM
  3. Replies: 1
    Last Post: 09-20-2011, 07:28 PM
  4. Multiple SQL Statements
    By springboardjg in forum Queries
    Replies: 1
    Last Post: 04-18-2011, 10:32 AM
  5. Multiple IIF statements
    By KevinMCB in forum Queries
    Replies: 4
    Last Post: 12-03-2010, 01:35 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