Results 1 to 7 of 7
  1. #1
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544

    What is wrong with this IIF statment?

    Points1: IIf([points] Between 3 And 5,2,0),IIf([points] Between 6 And 9,4,0)



    I've used nested IIF before, but not with "between".

    TIA!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    What does the ,2,0 mean??? What are you trying to do --in plain English?

    Syntax details and example of IIF

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Try this amended version

    Code:
    Points1: IIf([points] Between 3 And 5,2,IIf([points] Between 6 And 9,4,0))
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    The IIf expressions are not nested. What error message?

    Try:

    Points1: IIf([points] Between 3 And 5, 2, IIf([points] Between 6 And 9, 4, 0))
    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.

  5. #5
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Orange, If the members points are between 3 and 5, then assign them 2, or 0, if they are between 6 and 9 then assign them 4 or zero. I should probably only have one zero at the end now that I think of it. I ended up doing in the long way, but I don't like it. I'll try your suggestion Ridders. And June, they are nested, they work fine separately.

    Thanks all, you rock!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    The original posted expression is not nested. It is two separate IIf and should error.
    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.

  7. #7
    Gina Maylone is offline Always learning
    Windows 10 Access 2016
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    This worked, thanks Ridders! Points1: IIf([points] Between 3 And 5,2,IIf([points] Between 6 And 9,4,0))

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

Similar Threads

  1. iF THEN VBA STATMENT
    By GCLIFTON in forum Queries
    Replies: 16
    Last Post: 07-15-2016, 02:43 PM
  2. Insert Statment - Is it too big?
    By todmac in forum Access
    Replies: 2
    Last Post: 03-02-2015, 07:21 PM
  3. if statment
    By ismailkhannasar in forum Access
    Replies: 3
    Last Post: 01-31-2013, 06:48 AM
  4. if statment or case statment?
    By whojstall11 in forum Forms
    Replies: 4
    Last Post: 07-09-2012, 01:44 PM
  5. Like statment
    By brew in forum Programming
    Replies: 2
    Last Post: 12-01-2011, 03:23 AM

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