Results 1 to 3 of 3
  1. #1
    rookie77 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012

    Please assist - Report showing #Num due to zero values

    I have a report that is returning percentages based upon other calculated fields. Some of the percentage fields are showing #Num on the report. I've found this is due to one of the calculated values being zero.

    3 Fields used:

    Field: Qty
    Total: Sum

    Field: InitQty
    Total: Sum

    Field: OrderQty: Sum([Qty]-[InitQty])
    Total: Expression

    I need two more fields to return percentages based off of those 3 fields. This is what I started out with:

    Field: InStock: [SumOfInitQty]/[SumOfQty]
    Total: Expression

    Field: Ordered: [OrderQty]/[SumOfQty]
    Total: Expression

    This works great until the query returns one that has sum of qty equal to zero.

    So this is what I've tried:

    Field: InStock: IIf(Nz([SumOfInitQty],0),0,[SumOfInitQty]/[SumOfQty])
    Total: Expression

    Seems like it should work but its still showing #Num when I run the query.
    Can someone help me figure this out?

  2. #2
    rookie77 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Nevermind, As soon as I went back to it I guess my brain woke up and decided to function for me lol. I guess I was making it more complicated than necessary. But if you're here would you mind explaining the Nz function a little better for me? Maybe I misunderstood the purpose of that function.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    The Great Land
    All Nz does is provide an alternate value if the field contains Null. Arithmetic with null returns null. If you want 0 as result, your expression could be:

    InStock: Nz([SumOfInitQty], 0) / [SumOfQty]
    How to attach file: 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. Combo Box filter not showing values
    By Chatholo in forum Forms
    Replies: 7
    Last Post: 08-01-2013, 08:53 AM
  2. Combo Box showing Blank Values
    By glen in forum Access
    Replies: 5
    Last Post: 11-24-2012, 09:44 AM
  3. showing all values in query
    By dashingirish in forum Queries
    Replies: 13
    Last Post: 02-17-2012, 04:38 PM
  4. Showing zero values in a Union Query
    By coach32 in forum Queries
    Replies: 5
    Last Post: 09-06-2011, 07:46 AM
  5. Sql query not showing all the values
    By usr123 in forum Access
    Replies: 0
    Last Post: 02-24-2010, 07:32 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 - Senior Forums