Results 1 to 13 of 13
  1. #1
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43

    Query headache


    Ive created a query to retrieve employee last name, first name, and the projects associated with each individual. What is a best way to add another field in this query to sum up the total numbers of projects assigned to each individual? My result shows the Employee multiple times with each Project they are associate with.

  2. #2
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43
    I need the same employee to only appear once with the Allocation summed up....

    Click image for larger version. 

Name:	accessquerynotworking.PNG 
Views:	24 
Size:	39.3 KB 
ID:	22304

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Create an Aggregate (Totals) Query by clicking on Totals button and changing the "Totals Row" value under the Allocation field from "Group By" to "Sum".

  4. #4
    fuecheefang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2015
    Posts
    43
    Quote Originally Posted by JoeM View Post
    Create an Aggregate (Totals) Query by clicking on Totals button and changing the "Totals Row" value under the Allocation field from "Group By" to "Sum".
    Thanks JoeM, it worked perfectly. Issue SOLVED.

  5. #5
    Sam11420 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2015
    Posts
    9
    Hi
    I have the very same problem but in my case I have no totals to group or sum - how do I get my data to NOT repeat itself

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Hi
    I have the very same problem but in my case I have no totals to group or sum - how do I get my data to NOT repeat itself
    Follow the same steps, except you do not change any of the fields Totals lines to "Sum". Simply leave them all as "Group By".

  7. #7
    Sam11420 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2015
    Posts
    9
    Hi I did as you suggested but they all still repeating itself

  8. #8
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    So, are you clicking on the Totals button so that the words "Group By" are showing up in the Totals row in all fields you are returning?
    Note that in order for the records to be grouped together, every single field you are returning to the query must be the same.

    If you are still having issues, please switch your query to SQL View and copy and paste your code here and then post a small data sample.

  9. #9
    Sam11420 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2015
    Posts
    9
    SELECT tbl_EmplQualification.Qualification, [Surname] & " " & [Name] AS Emp, tbl_medical.[Expiry Date], tbl_yrsofexp.[Work Exp Type], tbl_yrsofexp.[Years of Exp]
    FROM ((tbl_Employee LEFT JOIN tbl_EmplQualification ON tbl_Employee.link = tbl_EmplQualification.link) LEFT JOIN tbl_medical ON tbl_Employee.link = tbl_medical.link) INNER JOIN tbl_yrsofexp ON tbl_Employee.link = tbl_yrsofexp.link
    GROUP BY tbl_Employee.Surname, tbl_Employee.Name, tbl_EmplQualification.Qualification, [Surname] & " " & [Name], tbl_medical.[Expiry Date], tbl_yrsofexp.[Work Exp Type], tbl_yrsofexp.[Years of Exp];



    I think this is my problem, you see I am using different tables and they all linked to tbl_Employee
    tbl_EmplQualification can have many qualifications linked to one employee and tbl_yrsofexp have many different types of work exp to one employee and tbl_medical only have one medical expiry date to one employee

    I would really appreciate your help.

  10. #10
    Sam11420 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2015
    Posts
    9
    Data Sample
    Qualification Emp Expiry Date Work Exp Type Years of Exp

    Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    ANDTC RT 1 Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    GRADE 11 Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    Other Management Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    RT Safety Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    S.H.E First Aid Basic Caine Bradley Rayle 01-Dec-16 Inspector Exp 12
    S.H.E SAMTRAC HIRA ASHEPP Caine Bradley Rayle 01-Dec-16 Inspector Exp 12

    Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2

    Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2
    Other Security Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2
    Other Security Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2
    RT Safety Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2
    RT Safety Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2
    S.H.E Fire Technology Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2
    S.H.E Fire Technology Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2
    S.H.E First Aid Level 1 Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2
    S.H.E First Aid Level 1 Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2
    S.H.E SAMTRAC HIRA ASHEPP Callaghan Reon Dane 15-Feb-16 NDT Assistant Exp 2
    S.H.E SAMTRAC HIRA ASHEPP Callaghan Reon Dane 15-Feb-16 Trade Pipe Fitter Exp 2

  11. #11
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    So, I don't see a single duplicate in your sample data. Every single entry has a different field combination.
    Look at the table in post #2 above. If we wanted to just remove duplicates when considering ALL the fields, the first and third second records would be duplicates, because EVERY single field in those two records are exactly the same. However, the second record is NOT a duplicate because the Allocation amount is different than the other two records. So doing an Aggregate Query on all the fields. Make sense?

    What exactly are you looking to return?

  12. #12
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @Sam11420,

    FYI,
    By posting your question under the thread by fuecheefang (the OP), you have done what is called "Hi-jacking a thread".
    You should have started your own thread and referenced the thread by fuecheefang.

    You will get more views by starting your own thread and referencing a thread by another poster.
    Last edited by ssanfu; 11-19-2015 at 02:23 PM.

  13. #13
    Sam11420 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2015
    Posts
    9
    Hi

    oh my, my apologies did not even know there was such a thing as thread hi-jacking.

    I created a post called multiple tables query. I am very new at access databases so please bear with me.

    please can you have a look at my post to see where I am going VERY wrong

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

Similar Threads

  1. Replies: 2
    Last Post: 12-12-2013, 01:21 PM
  2. Query Criteria causing a headache
    By GavinBlackburn in forum Queries
    Replies: 2
    Last Post: 07-12-2011, 04:55 AM
  3. Huge Query Headache
    By Gary in forum Access
    Replies: 1
    Last Post: 08-09-2010, 07:35 AM
  4. Replies: 3
    Last Post: 08-06-2009, 11:49 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