Results 1 to 3 of 3

Thread: Error Handling

  1. #1
    Join Date
    Jul 2004

    Unhappy Unanswered: Error Handling

    Hi GUys
    I have a problem with a query in access. I am trying to divide two numbers by each other. When I run the quesry it gives me an error message. I have tried to amend the query with the iif iserror command but that doesnt work either.

    can somebody suggest the best way to do this??


    I have agiven an example of the query below

    total %: IIf(IsError([DA Arrests LY]/[DA Arrests TY]),0,([DA Arrests LY]/[DA Arrests TY]))

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    what's the error? div / 0 ?

    try this:

    total %: [DA Arrests LY] / nz([DA Arrests TY], 1)

    edit: I suppose I should explain that logic...

    If DA Arrests TY is null, then the result will be 100% which is mathematically sound.
    Last edited by Teddy; 07-07-04 at 14:39.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Feb 2004
    Chicago, IL
    I would do the following:

    IIf([DA Arrests TY]=0,"?",([DA Arrests LY]/[DA Arrests TY])

    Replace the ? with whatever you want. But it might be misleading to put in a zero.

Posting Permissions

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