Results 1 to 6 of 6
  1. #1
    snowygirl1 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Oct 2016
    Posts
    10

    Query isn't totalling correctly

    I have a query which is pulling names of volunteers.
    The DB contains the dates they have volunteered and how many hours for each of those dates. Essentially volunteers need to undertake a certain number of hours per month etc.



    The query is pulling the volunteers names and how many hours they've done along with the date they volunteered.
    I need the query to be able to be for specific date periods so I added the date field of when they volunteer and then set that to criteria "Between [Start Date DD/MM/YY] And [End Date DD/MM/YY]" so that when I launch the query it prompts for the date period I need to view.

    The query & report appear to work fine but when we checked the totals they aren't correct.
    We have some volunteers with the same first names, and we are finding the query is summing people with the same first name together. E.g. we have 3 x John's but only one is displayed in the final results with the total hours of all volunteer work from all 3 people named John.
    I cannot work out why it's doing this.
    Can anyone point me in the direction of how I fix this?

  2. #2
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Sorting or using aggregate functions on such a field is not advised, for exactly the problem that you are experiencing. You need to use a field that uniquely identifies the individual. Without knowing what your table looks like, I can only guess what that might be. You should have a table for only volunteer names and pertinent data (such as DOB, phoneNum, etc) without any other data such as hours worked. In a query, you would join that table to the hours table and link via the unique field from the names table to the hours table, which would also have that identifier, but once for every record of hours worked.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    snowygirl1 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Oct 2016
    Posts
    10
    I've just looked closer and the query is actually working and I can see that there are 3 x John's.

    It's in the Report that the problem is occurring because I can see in the query there are 3 x John's. But the report only shows 1.

    I have a main table which contains all the persons details DOB etc. It is then linked to a volunteer table where we record all volunteer hours. They are linked by a volunteer ID number.

  4. #4
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Are you grouping by the name in the report, or by the volunteer ID number? Or something else?
    I presume you mean 3 different Johns, not just 3 John records.

  5. #5
    snowygirl1 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Oct 2016
    Posts
    10
    Ok I think I've fixed it.
    I've added the ID to the query & report and it seems to be working now.
    But now i cannot remember how to set the sort order so that the list is in alphabetical order by surname rather than by the ID.

  6. #6
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Grouping and sorting button on ribbon. Or right click on report and choose that from the resulting context menu. Reports have their own sorting feature, so it doesn't matter if you sort the query or not.

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

Similar Threads

  1. Totalling in main form
    By edwardcga in forum Forms
    Replies: 2
    Last Post: 10-26-2013, 09:24 PM
  2. Replies: 15
    Last Post: 12-10-2012, 06:37 PM
  3. Need help with totalling a field in Subform
    By Astron2012 in forum Forms
    Replies: 1
    Last Post: 05-18-2012, 04:49 AM
  4. Totalling
    By cbrsix in forum Reports
    Replies: 17
    Last Post: 11-17-2011, 02:54 PM
  5. Totalling Time Values
    By l3111 in forum Access
    Replies: 2
    Last Post: 07-16-2011, 08:05 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