Results 1 to 6 of 6
  1. #1
    mdnikki is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    63

    How to use iif statement in a query

    I am trying to get a query to determine who in my table is past due on payments.



    I have two fields which will be used to determine this. 1) Total due and 2) Installment Amount_1

    So if the total due is greater than the installment payment amount that means they are in arrears.

    I just can't seem to figure out how to get this to work.

    I was thinking I needed an iif statement like this
    Delinquent: IIf([RE_Mail_Reminder_6]![Total Due]>[RE_Mail_Reminder_6]![Installment Amount_1],"delinquent")

    Do I need this to be an update query to update that field Delinquent? Not sure how this will work.

    Thanks

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    No, I don't think you want Delinquent to be a table field, you want it to be a dynamic calculation like you have set up.
    Note that the IIF function has three arguments (last one, what to return if FALSE). If you do not want it to return anything if FALSE, just write it like this:
    Code:
    Delinquent: IIf([RE_Mail_Reminder_6]![Total Due]>[RE_Mail_Reminder_6]![Installment Amount_1],"delinquent","")

  3. #3
    mdnikki is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    63
    Thank you..but where does it show the return in what field? I used what is above and I just don't see where it put delinquent at all. Not in the delinquent field, not in the total due or installment amount field.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You won't have a Delinquent field in your underlying table, it will be a Calculated Field in a Query.
    Take a look at "Calculated Fields" or "Expressions" in Access' built-in help files if you need to read up more on it to gain a better understanding of how to enter these.

  5. #5
    mdnikki is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    63
    Ok I knew I wouldn't get the field in the table. I figured out why I couldn't see the calculated field, I had it named the same as an existing field. So now I changed the name of the calculated field but now I am getting a # error in that field.

  6. #6
    mdnikki is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    63
    Never mind, I figured it out..one of my fields was text and the other was currency, once I made them both currency the error is gone.

    Thanks.

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

Similar Threads

  1. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  2. Replies: 3
    Last Post: 07-10-2012, 05:23 AM
  3. Iif Statement in query
    By evanhughes in forum Queries
    Replies: 1
    Last Post: 11-03-2011, 08:55 AM
  4. query iif statement help
    By swat in forum Queries
    Replies: 4
    Last Post: 09-30-2011, 11:48 AM
  5. Help fix SQL Statement for query
    By Budro49 in forum Queries
    Replies: 12
    Last Post: 06-21-2011, 02:26 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