Results 1 to 3 of 3
  1. #1
    Bearcreek is offline Novice
    Windows 10 Office 365
    Join Date
    Nov 2021
    Posts
    1

    =IIf statement with compounds conditions with different fields in same record

    Partial record in MS Access 365 running under windows 10 using Parallels for Windows on iMac with Intel I7

    -------------------------------------------------------------------------------------------------------
    | ID | transName | transDate | transType | transAmount |


    --------------------------------------------------------------------------------------------------------
    | 11561 | 129 | 1/31/2014 | xfer | $1,000.00 |
    --------------------------------------------------------------------------------------------------------
    =IIf([transType] = "xfer" And [transAmount] > 0, [transAmount]) does not yield anything in the unbound textbook containing the above statement. No input is desired if the compound condition is false.

    Any assistance is appreciated.

  2. #2
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The syntax if the Immediate If function is
    Code:
    IIF (condition, TRUE, FALSE)
    You are missing the FALSE option.

    condition = [transType] = "xfer" And [transAmount] > 0

    if condition is TRUE then return [transAmount]
    else if condition is FALSE return 0 ???




    Maybe
    Code:
    =IIf([transType] = "xfer" And [transAmount] > 0, [transAmount], 0)
    
    or
    =IIf([transType] = "xfer" And [transAmount] > 0, [transAmount],"")
    
    or
    =IIf([transType] = "xfer" And [transAmount] > 0, [transAmount], NULL)

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    FYI I moved your thread to a more appropriate forum. Welcome to the site!
    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. Help Statement meeting 2 conditions
    By Holli in forum Programming
    Replies: 5
    Last Post: 05-08-2015, 07:17 AM
  2. iff statement with a few conditions
    By Eric2013 in forum Queries
    Replies: 2
    Last Post: 09-15-2014, 06:12 PM
  3. Replies: 5
    Last Post: 10-21-2013, 06:44 PM
  4. iif statement with multiple conditions
    By ragsgold in forum Queries
    Replies: 7
    Last Post: 08-24-2011, 05:38 PM
  5. Iff Statement Meeting 2 Conditions
    By newbie in forum Access
    Replies: 11
    Last Post: 06-11-2009, 11:59 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