I'm attempting to turn an already working UNION
query into a SELECT INTO
as part of a VBA
procedure for a bunch of temp tables. I'm doing this because Access is having performance issues.
When I try to run this query with the INTO
clauses inserted, I get this error:
"An action query cannot be used as a row source."
I'm not entirely sure why I can't execute it or how to get around it without creating more queries. What is causing this and how do I fix it?
SELECT DISTINCT A.*
FROM (SELECT DISTINCT
C.[CUSTOMER CODE],
D.[FISCAL DAY],
D.[TY INVOICE DATE] AS [Invoice Date],
C.[CUSTOMER CODE]&" - "&D.[FISCAL DAY] AS CONCAT,
IIF(D.[TY INVOICE DATE] Is Not Null, 'TY', Null) As TYLY
***INTO [FD CUST Missing- Temp]***
FROM [QR- CUST FD] AS C,
[QR- FD SALES] AS D) AS A
LEFT JOIN [QR- CUST FD] AS C
ON C.[FD CONCAT] = A.[CONCAT]
WHERE C.[FD CONCAT] Is Null
UNION ALL
SELECT DISTINCT
A.*
***INTO [FD Cust Missing- Temp]***
FROM (SELECT DISTINCT
C.[CUSTOMER CODE],
D.[FISCAL DAY],
D.[LY INVOICE DATE] AS [Invoice Date],
C.[CUSTOMER CODE]&" - "&D.[FISCAL DAY] AS CONCAT,
IIF(D.[LY INVOICE DATE] Is Not Null, 'LY', Null) As TYLY
FROM [QR- CUST FD] AS C,
[QR- FD SALES] AS D) AS A
LEFT JOIN [QR- CUST FD] AS C
ON C.[FD CONCAT] = A.[CONCAT]
WHERE C.[FD CONCAT] IS NULL
;