I'm trying to run a query, and append the results to an existing table. I'm getting:
"You tried to execute a query that does not include the specified expression 'Year' as part of an aggregate function."
Here is the query:
I get the error *regardless* of whether or not the table to be appended to (tbl_master_mysite) contains the field 'Year.' Note that, in the query, 'Year' is a 'WHERE' parameter, so the year actually should not show up in the results anyway.
I realize that 'Year' is a reserved keyword in Access, but it's also the name of a field in the source data. I will have to go through this process hundreds of times, so I don't want to have to change the field name in the source data.
"You tried to execute a query that does not include the specified expression 'Year' as part of an aggregate function."
Here is the query:
Code:
INSERT INTO tbl_master_mysite( [Campaign ID], [IntraSite Site], [Year], [Month], [Confidence %], [As Of] )
SELECT [2012 Data from sep 10 2012].[Campaign ID], [2012 Data from sep 10 2012].[IntraSite Site], [2012 Data from sep 10 2012].Year, [2012 Data from sep 10 2012].Month, [2012 Data from sep 10 2012].[Confidence %], [2012 Data from sep 10 2012].[As Of]
FROM [2012 Data from sep 10 2012]
WHERE ((([2012 Data from sep 10 2012].Year)=2012))
GROUP BY [2012 Data from sep 10 2012].[Campaign ID], [2012 Data from sep 10 2012].[IntraSite Site], [2012 Data from sep 10 2012].Month, [2012 Data from sep 10 2012].[Confidence %], [2012 Data from sep 10 2012].[As Of]
HAVING ((([2012 Data from sep 10 2012].[IntraSite Site])="mysite.COM"));
I get the error *regardless* of whether or not the table to be appended to (tbl_master_mysite) contains the field 'Year.' Note that, in the query, 'Year' is a 'WHERE' parameter, so the year actually should not show up in the results anyway.
I realize that 'Year' is a reserved keyword in Access, but it's also the name of a field in the source data. I will have to go through this process hundreds of times, so I don't want to have to change the field name in the source data.