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. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,513
    Thanks
    3
    Thanked 47 Times in 47 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
  •