I have a issue in Access with my query, it used to be a "Select" query, that would grab all data that was 7+ years old.
Heres the code:
SELECT RECTRANS.ContractNumber, Max(RECTRANS.TransactionDate) AS MaxOfTransactionDate, DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])) AS Expr1
FROM RECTRANS
GROUP BY RECTRANS.ContractNumber
HAVING (((DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])))<Now()));
---- I want this to delete these records it displays, so I changed it to "DELETE"
DELETE RECTRANS.ContractNumber, Max(RECTRANS.TransactionDate) AS MaxOfTransactionDate, DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])) AS Expr1
FROM RECTRANS
GROUP BY RECTRANS.ContractNumber
HAVING (((DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])))<Now()));
Now, when I run the query, it gives an error "Can't group fields selected with '*'. I cannot seem to find this '*', I must be missing something, or is the line "FROM RECTRANS" being seen as the item with the '*' on the end of it???
Thanks for reading
Heres the code:
SELECT RECTRANS.ContractNumber, Max(RECTRANS.TransactionDate) AS MaxOfTransactionDate, DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])) AS Expr1
FROM RECTRANS
GROUP BY RECTRANS.ContractNumber
HAVING (((DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])))<Now()));
---- I want this to delete these records it displays, so I changed it to "DELETE"
DELETE RECTRANS.ContractNumber, Max(RECTRANS.TransactionDate) AS MaxOfTransactionDate, DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])) AS Expr1
FROM RECTRANS
GROUP BY RECTRANS.ContractNumber
HAVING (((DateAdd('yyyy',7,Max([RECTRANS].[TransactionDate])))<Now()));
Now, when I run the query, it gives an error "Can't group fields selected with '*'. I cannot seem to find this '*', I must be missing something, or is the line "FROM RECTRANS" being seen as the item with the '*' on the end of it???
Thanks for reading