I have limited Access experience and need some help.
I have the following query:
Code:
SELECT tbltempPositions.client, tblSecuritiesCategorized.CategoryId, tblcategory.CategoryDescription, Sum([amount]*[categoryPercentage]) AS CatAmount, tblClients.EquityTarget, qryClientsWithHoldings.TotalPortfolio
FROM ((tblcategory RIGHT JOIN (tbltempPositions INNER JOIN tblSecuritiesCategorized ON tbltempPositions.security = tblSecuritiesCategorized.Security) ON tblcategory.CategoryId = tblSecuritiesCategorized.CategoryId) INNER JOIN tblClients ON tbltempPositions.client = tblClients.client) INNER JOIN qryClientsWithHoldings ON tblClients.client = qryClientsWithHoldings.client
GROUP BY tbltempPositions.client, tblSecuritiesCategorized.CategoryId, tblcategory.CategoryDescription, tblClients.EquityTarget, qryClientsWithHoldings.TotalPortfolio;
I'm trying to add some information to the query from a table that isn't referenced yet in the query: tblModelTargets. Specifically, I need to add the field tblModelTargets.AssetClassTarget but every time I do this in design view, my query results go from around 4,000 records to upwards of 50,000 records. I can't figure out how to add this table correctly.
Here is the resulting SQL when I add tblModelTargets to the query:
Code:
SELECT tbltempPositions.client, tblSecuritiesCategorized.CategoryId, tblcategory.CategoryDescription, Sum([amount]*[categoryPercentage]) AS CatAmount, tblClients.EquityTarget, qryClientsWithHoldings.TotalPortfolio, tblModelTargetsNew.AssetClassTarget
FROM (((tblcategory RIGHT JOIN (tbltempPositions INNER JOIN tblSecuritiesCategorized ON tbltempPositions.security = tblSecuritiesCategorized.Security) ON tblcategory.CategoryId = tblSecuritiesCategorized.CategoryId) INNER JOIN tblClients ON tbltempPositions.client = tblClients.client) INNER JOIN qryClientsWithHoldings ON tblClients.client = qryClientsWithHoldings.client) LEFT JOIN tblModelTargetsNew ON tblClients.EquityTarget = tblModelTargetsNew.EquityTarget
GROUP BY tbltempPositions.client, tblSecuritiesCategorized.CategoryId, tblcategory.CategoryDescription, tblClients.EquityTarget, qryClientsWithHoldings.TotalPortfolio, tblModelTargetsNew.AssetClassTarget;
The other fields in the table tblModelTargets are EquityTarget, CategoryID, and AssetClassTarget. Any help would be much appreciated.