Results 1 to 4 of 4
  1. #1
    Jaik is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Aug 2016
    Posts
    33

    Using IIF in calculation in access 2007

    =Round(DSum("[Rebate]","QuarterWorkingDetail","[Quarter Year]= ""32016""")-([Q3Payment]+[Q3Adjustment]),2)

    For now, I have my calculation like that. However, problem with this calculation is if I don't have "[Quarter Year]= ""32016""" data it will return nothing in the text box. So In order to get 0 for null values, I used IIF function for this calculation.

    =IIf(Round(DSum("[Rebate]","QuarterWorkingDetail","[Quarter Year]= ""32016""")-([Q3Payment]+[Q3Adjustment]),2),IIf(IsNull(Round(DSum("[Rebate]","QuarterWorkingDetail","[Quarter Year]= ""42016""")-([Q4Payment]+[Q4Adjustment]),2)),0))

    The thing is I am getting 0, even though I have data in 32016. Is there any way to solve this problem? Is my calculation wrong?



    Thank you

  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,518
    Unless I'm misreading it, you don't actually test for anything. If the result is Null, try using the Nz() function instead.

    =Nz(Round(DSum("[Rebate]","QuarterWorkingDetail","[Quarter Year]= ""32016""")-([Q3Payment]+[Q3Adjustment]),2), 0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jaik is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Aug 2016
    Posts
    33
    Sweeeeet!! Thank you so much! This is what I was trying to do

  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,518
    Happy to help and 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. Replies: 5
    Last Post: 06-05-2015, 10:00 AM
  2. Replies: 1
    Last Post: 02-04-2013, 05:52 PM
  3. Replies: 2
    Last Post: 06-28-2012, 09:45 AM
  4. Export Table in Access 2007 to Multiple Workbooks in Excel 2007
    By hutchinsm in forum Import/Export Data
    Replies: 5
    Last Post: 03-01-2012, 05:23 PM
  5. Replies: 2
    Last Post: 06-18-2011, 09:55 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