Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Oct 2013
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access 2010 division by 0 error

    Hi, I have got a div by 0 problem which I've tried to get round by using an IIf statement with no luck. It's in an aggregate query grid, the formula is in "expression" mode and is:

    Sum([I3]*([DirectHours]/[B3]))

    I've tried Iif (([b3]=0,"",...... but no luck.

    Can anyone tell me what I'm doing wrong? Thanks so much

    BL

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,494
    Thanks
    3
    Thanked 42 Times in 42 Posts
    First, is this in a query or behind a form or report? Since you are attempting to use the Immediate If function, I will presume it is in a query. In that case, the syntax should be something like Sum([I3] * IIF(Nz([B3],0)=0,0,[DirectHours]/[B3])) - note that is untested aircode - but the idea is to deal not only with the 0 case, but also with the case where [B3] is null. That uses the Nz() function to return a 0 if it is null.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •