Hi all,
"you tried to execute a query that does not include the specified expression 'lngzShowID' as part of an aggregate function"
I'm trying to do a totals / summation in SQL but I am getting the above error.
My code is:
I tried to change the group by statement to "GROUP BY lngzEntrantID, lngzShowID, lngzClassID" but then it doesn't do what I want.
I don't understand what I need to do.
Please help!
Thanks in advance.
Simon
"you tried to execute a query that does not include the specified expression 'lngzShowID' as part of an aggregate function"
I'm trying to do a totals / summation in SQL but I am getting the above error.
My code is:
Code:
[SIZE=2] Dim strRHSBMSelect As String
Dim strRHSBMWhere As String
Dim strRHSBMSQL As String
strRHSBMSelect = "SELECT tblShowEntrantClass.lngzShowID, " _
& "tblShowEntrantClass.lngzEntrantID, " _
& "tblShowEntrantClass.lngzClassID, " _
& "SUM(tblShowEntrantClass.numPoints) " _
& "FROM tblShowEntrantClass " _
& "WHERE "
strRHSBMWhere = "tblShowEntrantClass.lngzShowID = " & Me.lngzShowID & " AND " _
& "lngzClassID BETWEEN 1 AND 13 " _
& "GROUP BY lngzEntrantID"
strRHSBMSQL = strRHSBMSelect & strRHSBMWhere & ";"
'print sql statement
MsgBox strRHSBMSQL
CurrentDb.QueryDefs("qryShowEntrantClassPoints").SQL = strRHSBMSQL
DoCmd.OpenForm "frmShowEntrantClassPoints", , , , , acDialog[/SIZE]
I don't understand what I need to do.
Please help!
Thanks in advance.
Simon