Originally Posted by
pbaldy
I've never seen that, but I'm glad you got it working. If you want to fix having the SQL in VBA, post the code here.
Gladly. When I come across a problem, I don't like to set it aside for another solution because I want to learn as much as I can.
So here is the SQL that Access had made.
Code:
INSERT INTO LMSB_Volume_Append ( MTH, SITENAME, [Count] )
SELECT LMSB_Volume_Q.Month, LMSB_Volume_Q.SITENAME, Sum(LMSB_Volume_Q.CountOfNAME) AS SumOfCountOfNAME
FROM LMSB_Volume_Q
GROUP BY LMSB_Volume_Q.Month, LMSB_Volume_Q.SITENAME;
I went ahead and readjusted the code for VBA as follows:
Code:
"INSERT INTO LMSB_Volume_Append ( MTH, SITENAME, [Count] )" & _
"SELECT LMSB_Volume_Q.Month, LMSB_Volume_Q.SITENAME, Sum(LMSB_Volume_Q.CountOfNAME) AS SumOfCountOfNAME" & _
"FROM LMSB_Volume_Q" & _
"GROUP BY LMSB_Volume_Q.Month, LMSB_Volume_Q.SITENAME;"
Again, the error I receive is "Query must contain at least one query or table." People have stated online that there may need to be extra spaces or some fields need to be in brackets because the field name may be the same as Access's Default name types. i.e. Month, Day, Name, etc. I adjusted the sql as much as I could see would need changing, but I could never get it to run.