Problem with a query that has multiple queries within it.

P

PatT123

I am having problems formatting a SQL Statement with Multiple joined Queries.
The query works in three pieces as named queries, but I want to pull it into
one query to put behind a form. Please help me find code that will help me
with the structure.

SELECT QRYPOSUpdt.PosNo, QRYPOSUpdt.Funding, QRYPOSUpdt.PCA,
QRYPOSUpdt.Fund, QRYPOSUpdt.FedGrant_PH, QRYPOSUpdt.OthGrant_PH,
QRYPOSUpdt.Percent, QRYPOSUpdt.SubProgram, QRYPOSUpdt.DIVFund,
QRYFTE.FTETotal , QRYFTE.SumOfPercent
FROM
([SELECT TBLFTETotals.FTETotal, QRY1.SumOfPercent, TBLFTETotals.DIVFund
FROM TBLFTETotals LEFT JOIN [SELECT Sum(TBLFundingToPos.Percent) AS
SumOfPercent, [TBLIndex]![DIV] & [TBLPCA]![Fund] AS DIVFUND
FROM (TBLIndex RIGHT JOIN TBLPosition ON TBLIndex.Index = TBLPosition.Index)
RIGHT JOIN ((TBLFunding LEFT JOIN TBLPCA ON TBLFunding.PCA = TBLPCA.PCA)
RIGHT JOIN TBLFundingToPos ON TBLFunding.Funding = TBLFundingToPos.Funding)
ON TBLPosition.PosNo = TBLFundingToPos.PosNo
GROUP BY [TBLIndex]![DIV] & [TBLPCA]![Fund]]. AS QRY1 ON
TBLFTETotals.DIVFund = QRY1.DIVFUND] AS QRYFTE)
RIGHT JOIN
([SELECT TBLFUNDINGTOPOS1.PosNo, TBLFUNDING1.Funding, TBLFUNDING1.PCA,
TBLPCA1.Fund, TBLFUNDING1.FedGrant_PH, TBLFUNDING1.OthGrant_PH,
TBLFUNDINGTOPOS1.Percent, TBLPCA1.SubProgram, TBLIndex1.DIV & TBLPCA1.Fund AS
DIVFund
FROM TBLIndex1
RIGHT JOIN ((TBLPosition1 ON TBLIndex1.Index=TBLPosition1.Index)
RIGHT JOIN ((TBLFunds RIGHT JOIN (TBLPCA1 ON TBLFunds.FUND=TBLPCA1.Fund))
RIGHT JOIN (TBLFUNDING1
RIGHT JOIN (TBLFUNDINGTOPOS1 ON
TBLFUNDING1.Funding=TBLFUNDINGTOPOS1.Funding))(ON
TBLPCA1.PCA=TBLFUNDING1.PCA)(ON TBLPosition1.PosNo=TBLFUNDINGTOPOS1.PosNo)))]
AS QRYPOSUpdt) On QRYFTE.DIVFund = QRYPOSUpdt.DIVFund;

Thank You
Pat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top