Results 1 to 7 of 7
  1. #1
    bkupper23 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    10

    Calculating the sum of a field for all records with a unique ID


    Hello everyone,

    I am trying to add up all my labor costs on my subform.

    The subform saves all the operations and associated labor costs under the same quote number.

    I am trying to calculate in the subforms footer the total labor costs for all the records.

    This is a dynamic situation because I may have 1 operation or 10 operations.

    Any help or just general guidance would be appreciated.

    This is my first go in a long time with Access.

    Click image for larger version. 

Name:	Labor Cost.jpg 
Views:	12 
Size:	110.5 KB 
ID:	26484

    Thanks in advance!

    Brandon

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    In the sub form, add a footer, in it put a text box,
    this is the sum of the field.....
    =sum(field)

  3. #3
    bkupper23 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    10
    So that's what I had done. The problem is it only pulls the data from the field of the record I'm on. I want it to pull all the records created on that particular subform.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    What you are saying can't be right! Show us the control source for that field.

  5. #5
    bkupper23 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    10
    I attempted to try what you suggested again and I am getting #error as you can see in the picture.

    Another thought was to just create another subform on the main form to calculate the total from a query.

    This works, however I am having a hard time updating the results when new input is made on subform 1. The data only refreshed upon opening back up the form.

    I think your suggestion would be much cleaner so I am trying to get that to work.

    Click image for larger version. 

Name:	Labor Cost.png 
Views:	6 
Size:	59.9 KB 
ID:	26487

  6. #6
    bkupper23 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    10
    My god.

    I feel like an idiot. I was tallying the text box and not the control itself.

    Thanks for your help in this!

  7. #7
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2013 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Don't sweat it, we need people to bounce things off sometimes!

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

Similar Threads

  1. Replies: 4
    Last Post: 04-06-2016, 01:29 PM
  2. Replies: 1
    Last Post: 04-29-2014, 12:20 AM
  3. Replies: 1
    Last Post: 04-07-2014, 07:04 AM
  4. 2 Records of unique field name
    By tonydepo in forum Queries
    Replies: 5
    Last Post: 03-20-2012, 11:40 AM
  5. Calculating the sum of every four records.
    By Alanlives in forum Queries
    Replies: 0
    Last Post: 07-31-2009, 05:56 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