Table (Field1, Field2)
a = "SELECT SUM(T.Field2) AS F FROM Table AS T WHERE T.field1=1"
Set rs = db.OpenRecordset(a)
It works.
but
a = "SELECT T.field1, SUM(T.Field2) AS F FROM Table AS T WHERE T.field1=1"
Set rs = db.OpenRecordset(a)
It doesn't work.
Run-time error '3122': You tried to execute a query that does not include the specified expresion 'field1' as part of an aggregate function.)
Bookmarks