Results 1 to 4 of 4
  1. #1
    MrOutside is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    2

    Query that discriminates Null and 0 does not work

    Hi,

    I'm new to the forum and have been looking for an answer to my issue but have been unsuccessful.
    Basically my issue is that there is a table that i am linked to from another database. This table has data for employees performance through out the year. What i need to do is divide the performance by a target to obtain a percentage of target value. But there are some fields that do not have data for a specific months and when i divide these values (0) by the target i get a overflow or div by zero error. I managed to exclude the data with a simple IIF([XXX])<>0, [XXX]/[Target], 0). After creating the % value i need to match that % to a Performance ID. But when i match all the % data to the Performance ID i keep getting and overflow or Division by Zero error i don't understand why if i am excluding the values for zero. I also tried with IIF(ISNull([XXX])=False,[XXX]/[target])
    where [XXX] <> 0
    where [xxx] <>""
    where Isnull([xxx])= False


    I've tried everything i can think of and would appreciate any help :S
    Below you can fin more or less what the data looks like. The percent to target would be the first desired result then that percentage would be turned to an ID like "Z+"



  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    Each part of an IIf must be able to be evaluated, even if it is not the part that returns the value. If any part cannot evaluate, the entire function will error.

    Unless the target can be 0, you are not dividing by 0 and the expression should not error. Calculations with Null result in null, even dividing null by 0 should return null. Your attachments did not post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MrOutside is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2013
    Posts
    2
    The problem is some performance evaluators are considered negative so the target is divided into the performance evaluator . In example if it takes me 20 mintutes when the target is 10 to do something. Then you would be dividing 10 by 0 if there is no information. The IIF statement does work in each individual query but when i try to join one performance indicator with another the query gives me and error. :S

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    Lost me. The formula says divide by target. If the target is 10 then I see the calculation would be [xxx]/10.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Update where query, why does it not work?
    By joris in forum Queries
    Replies: 10
    Last Post: 05-18-2012, 01:26 AM
  2. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  3. Can't get my query work with a combo box
    By Grek in forum Queries
    Replies: 4
    Last Post: 10-28-2011, 01:13 PM
  4. Replies: 7
    Last Post: 10-25-2011, 08:32 PM
  5. Replies: 2
    Last Post: 01-03-2011, 05:17 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