Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Analogkid is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    27

    Invoice Report not adding totasl unless all fields are filled in.


    I have an Invoice form that when I run it, it does not give the total unless I have all fields filled in. The totals come from 3 different queries from a form. But when I run the report, it gives me a #error on the blank totals and will not fill in the Grand total unless all total fields are filled in. See screenshot. What is the best way to fix this? I have the totals in the footer with an expression of =[Mat_invoice].[Report]![SumOfMaterialTotal]
    The Grand Total expression is =[Emp_invoice subreport].[Report]![SumOfEmpTotal]+[Equip_invoice subreport].[Report]![SumOfEquipTotal]+[Mat_invoice].[Report]![SumOfMaterialTotal]
    Is there a way to default the empty fields as 0 so the total can be filled? The grand total works if all of the fields are filled in.
    Thank you for your time.

    Attachment 7758

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Haven't looked at the attachment, but this sounds like what you need:

    nnz function
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The attachment link isn't working anyway.
    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.

  4. #4
    Analogkid is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    27

    nnz function

    Where would I put the nnz function? Here is a sample of my DB. Pick a code and selecte a user with total hours. Then, run the Invoice report.
    Attached Files Attached Files

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Anyplace you're referring to the subreport:

    =[Emp_invoice subreport].[Report]![SumOfEmpTotal]

    you would use the function:

    =nnz([Emp_invoice subreport].[Report]![SumOfEmpTotal])
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Except I think the function is Nz not nnz.

    If the value argument is not used what is returned depends on where the Nz is used http://office.microsoft.com/en-us/ac...001228890.aspx but can return any specified value. As example:

    =Nz([Emp_invoice subreport].[Report]![SumOfEmpTotal], 0)
    Last edited by June7; 05-24-2012 at 09:39 PM.
    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.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by June7 View Post
    Except I think the function is Nz not nnz.
    No, read the link.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Oh, thanks Paul, I see you created a custom function.

    I have used the intrinsic Nz function extensively and encountered issue with it only with Excel VBA. I think the Nz is Access specific.
    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.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Well, I didn't create the custom function, Keri Hardwick did,and the built-in Nz() would not work in this situation anyway.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Finally looked at the project and read the link more carefully and understand issue better. Yes, I can see that Nz not applicable. I just never had to build reports like this so didn't immediately recognize what was happening.

    Can use the function call or an IIf expression in the textbox:
    =IIf(IsError([Mat_invoice].[Report]![SumOfMaterialTotal]),0,[Mat_invoice].[Report]![SumOfMaterialTotal])
    =IIf(IsNumeric([Mat_invoice].[Report]![SumOfMaterialTotal]),[Mat_invoice].[Report]![SumOfMaterialTotal],0)

    Then the GrandTotal expression would be: =[EmpTotal]+[EquipTotal]+[MatTotal]
    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.

  11. #11
    Analogkid is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    27
    Can use the function call or an IIf expression in the textbox:
    =IIf(IsError([Mat_invoice].[Report]![SumOfMaterialTotal]),0,[Mat_invoice].[Report]![SumOfMaterialTotal])
    =IIf(IsNumeric([Mat_invoice].[Report]![SumOfMaterialTotal]),[Mat_invoice].[Report]![SumOfMaterialTotal],0)

    Then the GrandTotal expression would be: =[EmpTotal]+[EquipTotal]+[MatTotal]

    I tried this but now, the results come out $1.00. Even if I enter something in, it remains $1.00

    Thank you for all of your time with this.
    Last edited by June7; 05-25-2012 at 02:26 PM. Reason: fix quote tag

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm too lazy to type all that out for every formula, but the nnz() works as advertised.

    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I tested with the posted project and the IIf's also worked.
    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.

  14. #14
    Analogkid is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    27
    June7 - You are a genius. Thanks for all of your help. The IIFs worked perfectly.
    Thanks pbaldy for your suggestions. I have found the IIfs function work the best.
    Now, ONE more thing- FIFO inventory. But that will be a different thread.
    BTW- How does my DB look as for functionality? I mean, do you see any potential issues with the way I have the structure or tables/queries etc??
    Thanks again for all of your help

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Structure looks good to me.

    Do have a few objects with spaces in names.

    Used Name as fieldname in WO_Customer and Name is a reserved word.
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. fields automatically filled in a new record
    By fabiobarreto10 in forum Forms
    Replies: 9
    Last Post: 04-09-2012, 05:18 PM
  2. How do I see only fields that are filled?
    By fabiobarreto10 in forum Forms
    Replies: 56
    Last Post: 01-01-2012, 09:51 PM
  3. Replies: 5
    Last Post: 07-19-2011, 11:56 AM
  4. query with fields that cannot be filled in
    By durstlaw in forum Queries
    Replies: 3
    Last Post: 07-23-2010, 12:03 AM
  5. Replies: 0
    Last Post: 10-14-2009, 02:44 AM

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