Results 1 to 4 of 4
  1. #1
    TheMegaSage is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    2

    Getting a total of all 24 values in one record

    I have a table with 28 fields. The first four are: Date, Product, Shift, Waste Type. The next 24 are unique 'waste points'. Each date/shift can have any number in any of those 24 fields. So yesterday (for example) we could have had 500 KG on waste point 10, 20 on waste point 16, and 400 on waste point 20.



    I am going to code a form that will allow users to select against a range of the first four criteria (not a problem), and then show the resultant numbers as a percentage for each waste point. This will require me to total all 24 waste point fields in each record to be the denominator. So in the example above, I need an easy way to say the denominator is 920. Keeping in mind I can have anywhere from 0 to 24 fields that have a value in them and need to be added to the total.

    Is there an easy way to do this? Or do I need to create a custom field that says something like: [point1]+[point2]+[point3]+[point4] ... up to 24? That would be a very long custom field.

    Any help would be greatly appreciated.

  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,641
    In my opinion the design isn't normalized. The 24 fields should be records in a related table. Given your example, that table would have 3 records in it for that date. Then your solution is a simple Sum(). As it is, yes, you have to add them up one-by-one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    TheMegaSage is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    2
    Thanks pbaldy; that is pretty much what I thought. I actually got around the problem by realizing I'm basically looking at a pareto here, so I created a form in Access that allows a date range to be chosen, and a Run button that updates the querydef of a specific query and copies the data to the system clipboard. I have an Excel file that I wrote earlier this year that auto generates a pareto chart, so I made a few modifications to that and bam, I have the user select the date range and click a button in Access, and then in Excel paste into a specific cell, click the pareto generator button, and BA bam, data sorted and a spiffy graph available.

    Good times.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 11-12-2012, 03:52 AM
  2. Calculating total values for groups in queries
    By Nixx1401 in forum Queries
    Replies: 7
    Last Post: 02-05-2012, 07:08 PM
  3. Adding values to equal total
    By showe2295 in forum Queries
    Replies: 2
    Last Post: 12-08-2011, 03:14 PM
  4. Replies: 7
    Last Post: 09-16-2011, 01:39 PM
  5. Replies: 2
    Last Post: 06-09-2011, 12:11 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