I have a query that uses some of Mile-O-Phile’s code for removing duplicates from a table. “Expr1” is the ID that identifies the tables that each of the records comes from.
When I use the following code, Access says: “You tried to execute a query that does not include the specified expression Expr1 as part of an aggregate function.”
But I don’t want Expr1 to be changed in any way.
I have no more luck when I try to do it as a totals QBE. Does anyone know the secret to get a field passed a totals query without stipulating “group” or “sum” or whatever, please?
The code that isn’t working is:
SELECT [qryUnionJM].[Expr1], [qryUnionJM].[ShortUrl], Sum([qryUnionJM].[SumOfHits]) AS SumOfSumOfHits
FROM qryUnionJM
GROUP BY [qryUnionJM].[ShortUrl]
HAVING (((Sum(qryUnionJM.SumOfHits))>2));
When I use the following code, Access says: “You tried to execute a query that does not include the specified expression Expr1 as part of an aggregate function.”
But I don’t want Expr1 to be changed in any way.
I have no more luck when I try to do it as a totals QBE. Does anyone know the secret to get a field passed a totals query without stipulating “group” or “sum” or whatever, please?
The code that isn’t working is:
SELECT [qryUnionJM].[Expr1], [qryUnionJM].[ShortUrl], Sum([qryUnionJM].[SumOfHits]) AS SumOfSumOfHits
FROM qryUnionJM
GROUP BY [qryUnionJM].[ShortUrl]
HAVING (((Sum(qryUnionJM.SumOfHits))>2));