Code:
Public Function getBoxContent()
oDB.Execute "DELETE * FROM counted", dbFailOnError
sQry = "INSERT INTO counted ( Family, Infra, box, collection, Specimens ) " _
& " SELECT DISTINCT A.Family, A.infra, A.BoxNo, A.Collection, Count(A.BoxNo) AS count " _
& " FROM boxes as A " _
& " WHERE NZ(A.Family,'') > '' AND A.boxno > 0 and InStr(A.Collection,'SC-') = 0;"
oDB.Execute sQry, dbFailOnError
End Function
This sql string returns error 3122 '"Family is not part of an aggregate function"