The first two queries below, are used in the third and fourth queries. Then the fifth query uses the third and fourth queries in an aggregate query. That fifth query gives an error "NO VALUE GIVEN FOR ONE OR MORE REQUIRED PARAMETERS".
Can I not use the third and fourth queries, as I do, in the fifth query?? I thought a query was treated as a table in Access and could be used accordingly.
1st query
qrySUBTTLQTDFUTAWAGEPEREMP
SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM EMPEARNPERWAGE
WHERE DATEPART('q',DATEPAID)=DATEPART('q',NOW()) AND
DATEPART('yyyy',DATEPAID)=DATEPART('yyyy',Now())
GROUP BY EMPNO
UNION SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM STARTUPEMPEARN
WHERE DATEPART('q',MQYENDDATE)=DATEPART('q',NOW()) AND
DATEPART('yyyy',MQYENDDATE)=DATEPART('yyyy',Now())
GROUP BY EMPNO;
2nd query
qrySUBTTLYTDFUTAWAGEPEREMP
SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM EMPEARNPERWAGE
GROUP BY EMPNO
UNION SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM STARTUPEMPEARN
GROUP BY EMPNO;
3rd query
qryTTLQTDFUTAWAGEPEREMP
SELECT [EMPNO], SUM([TTLFUTAWGE]) AS TTLQTDFUTAWGE
FROM qrySUBTTLQTDFUTAWAGEPEREMP
GROUP BY [EMPNO];
4th query
qryTTLYTDFUTAWAGEPEREMP
SELECT [EMPNO], SUM([TTLFUTAWGE]) AS TTLYTDFUTAWAGE
FROM qrySUBTTLYTDFUTAWAGEPEREMP
GROUP BY [EMPNO];
5th query
SELECT SUM(qryTTLYTDFUTAWAGEPEREMP.TTLYTDFUTAWAGE)-SUM(qryTTLQTDFUTAWAGEPEREMP.TTLQTDFUTAWAGE) AS TTL
FROM qryTTLYTDFUTAWAGEPEREMP,qryTTLQTDFUTAWAGEPEREMP
TNN, Tom
TNPAYROLL@AOL.COM
TOM
Can I not use the third and fourth queries, as I do, in the fifth query?? I thought a query was treated as a table in Access and could be used accordingly.
1st query
qrySUBTTLQTDFUTAWAGEPEREMP
SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM EMPEARNPERWAGE
WHERE DATEPART('q',DATEPAID)=DATEPART('q',NOW()) AND
DATEPART('yyyy',DATEPAID)=DATEPART('yyyy',Now())
GROUP BY EMPNO
UNION SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM STARTUPEMPEARN
WHERE DATEPART('q',MQYENDDATE)=DATEPART('q',NOW()) AND
DATEPART('yyyy',MQYENDDATE)=DATEPART('yyyy',Now())
GROUP BY EMPNO;
2nd query
qrySUBTTLYTDFUTAWAGEPEREMP
SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM EMPEARNPERWAGE
GROUP BY EMPNO
UNION SELECT EMPNO,SUM(FUTAWGE) AS TTLFUTAWGE
FROM STARTUPEMPEARN
GROUP BY EMPNO;
3rd query
qryTTLQTDFUTAWAGEPEREMP
SELECT [EMPNO], SUM([TTLFUTAWGE]) AS TTLQTDFUTAWGE
FROM qrySUBTTLQTDFUTAWAGEPEREMP
GROUP BY [EMPNO];
4th query
qryTTLYTDFUTAWAGEPEREMP
SELECT [EMPNO], SUM([TTLFUTAWGE]) AS TTLYTDFUTAWAGE
FROM qrySUBTTLYTDFUTAWAGEPEREMP
GROUP BY [EMPNO];
5th query
SELECT SUM(qryTTLYTDFUTAWAGEPEREMP.TTLYTDFUTAWAGE)-SUM(qryTTLQTDFUTAWAGEPEREMP.TTLQTDFUTAWAGE) AS TTL
FROM qryTTLYTDFUTAWAGEPEREMP,qryTTLQTDFUTAWAGEPEREMP
TNN, Tom
TNPAYROLL@AOL.COM
TOM