Results 1 to 3 of 3
  1. #1
    koncreat is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2015
    Location
    U.S.
    Posts
    43

    Query not calculating all fields

    I have a table with 5 fields. One is the key which is auto number and the other are numeric value fields. When someone enters data they won't necessarily enter a value for each field. The field names are:

    Cast


    Finishing
    Machined
    Assembled

    The problem I am running into is when I create a query so I can get totals the query is only showing what is entered in the first field in the table, cast, even if the other fields a value entered or not. The field name in the query for the total is Suspect and the calculation I am using is:

    Suspect: Nz([Suspect_Cast],"0"+Nz([Suspect_Finished],"0"+Nz([Suspect_Machined],"0"+Nz([Suspect_Assembled],"0"))))
    Attached Thumbnails Attached Thumbnails sorts.JPG  

  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,652
    Each Nz() function should be used on a single field, and don't surround the 0 with quotes.

    Nz(FieldName, 0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Peter M is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2017
    Posts
    67
    Baldy's correct about what is going wrong with your formula but if the datatable is configured to not allow nulls then there will always be 0 or a value and you don't need to use NZ. (Under Table Definition, set Required=Yes)


    SuspectTotal = [Cast]+ [Finishing]+[Machined]+[Assembled]

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

Similar Threads

  1. Replies: 1
    Last Post: 04-09-2018, 06:18 AM
  2. Calculating a two date fields! Help please
    By Enigma in forum Access
    Replies: 3
    Last Post: 01-29-2017, 11:32 AM
  3. Replies: 2
    Last Post: 07-26-2014, 12:05 PM
  4. Replies: 0
    Last Post: 03-09-2012, 07:04 AM
  5. calculating time fields
    By donnan33 in forum Programming
    Replies: 5
    Last Post: 01-19-2012, 12:15 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