Okay, so I have an SQL string to use as the recordsource for a subform.
What I would like to do though is sort the data by date and group it by it's category.
If I just use the ORDER BY then the string works well, but as soon as I bring the GROUP BY into the equation then I start getting errors "Your query does not include the specified expression Issue_Employee_ID as part of an aggregate function"
Here is the code:
To be honest this is beyond me so if someone could point out where I'm going wrong it would be much appreciated!
many thanks, Lol
What I would like to do though is sort the data by date and group it by it's category.
If I just use the ORDER BY then the string works well, but as soon as I bring the GROUP BY into the equation then I start getting errors "Your query does not include the specified expression Issue_Employee_ID as part of an aggregate function"
Here is the code:
Code:
"SELECT Tbl_Issue.Issue_Employee_ID, Tbl_Employees.Employee_Employee_Name, Tbl_PPE.PPE_PPE_Category, Tbl_PPE.PPE_PPE_Description, Tbl_Issue.Issue_PPE_Size, Tbl_Issue.Qty_Issue, Tbl_Issue.Date_Issued " & _
"FROM Tbl_Employees INNER JOIN (Tbl_PPE INNER JOIN Tbl_Issue ON Tbl_PPE.[PPE_ID] = Tbl_Issue.[Issue_PPE_ID]) ON Tbl_Employees.Employee_Employee_ID = Tbl_Issue.Issue_Employee_ID " & _
"WHERE Tbl_PPE.PPE_PPE_Category= Cbo_PPE_Category.Value AND Tbl_Issue.Date_Issued Between Txt_Start_Date.Value And Txt_End_Date.Value GROUP BY Tbl_Issue.Issue_PPE_ID ORDER BY Tbl_Issue.Date_Issued;"
To be honest this is beyond me so if someone could point out where I'm going wrong it would be much appreciated!
many thanks, Lol