I have a database in Access 2003 that is attempting to insert rows from table A into table B. One of the columns in table B is a date, which is derived by taking the minimum date from table A and using that to populate every row that is inserted into table B at this time. The insert query in SQL is below:
when I hit the button to see the results in datasheet view or try to execute the query I get this error:
'Syntax error. in query expression '(select min([ACTUAL DATE IN]) from krtimecsv)'.
The thing that is oddest about this is that I have this particular query called from a macro that gets run every week. And it appears that it ran without error based on the fact that it actually populated the table with the desired data on it's own. Is there any reason why it would error out now, but not in a macro? Does anyone know of a better way to accomplish this that maybe wouldn't cause a problem? Thanks.
Code:
[I]INSERT INTO tblSUPERVISOR_SUMMARY (WEEK, SUPERVISOR, other stuff) SELECT (select min([ACTUAL DATE IN]) from krtimecsv) AS Expr1, tblPIVOT_OVT.SUPERVISOR, other stuff FROM tblPIVOT_OVT RIGHT JOIN tblSUM_HOURS_ALL_PAY_CODE ON tblPIVOT_OVT.[EMPLOYEE NUMBER] = tblSUM_HOURS_ALL_PAY_CODE.[EMPLOYEE NUMBER] GROUP BY (select min([ACTUAL DATE IN]) from krtimecsv), tblPIVOT_OVT.SUPERVISOR;[/I]
'Syntax error. in query expression '(select min([ACTUAL DATE IN]) from krtimecsv)'.
The thing that is oddest about this is that I have this particular query called from a macro that gets run every week. And it appears that it ran without error based on the fact that it actually populated the table with the desired data on it's own. Is there any reason why it would error out now, but not in a macro? Does anyone know of a better way to accomplish this that maybe wouldn't cause a problem? Thanks.
Comment