My challenge this evening involves two simple tables and an update query. I have the following two tables with the fields below each table name.
tblCosts
fkSum
strType
curAmount
tblSummary
pkey
curCards
curMachines
For each pkey in tblSummary that has records linked on fkSum in tblCosts, I need to update the tblSummary.curCards with the sum of tblCosts.curAmount where tblCost.strType=”Blackjack”, In english, I need to take the sum of the amounts in tblCosts and update tblSummary with the results.
In a attempt to accomplish this I created the below select query:
SELECT Sum(tblCost.curAmount) AS SumOfcurAmount, tbl.fkSum
FROM tblCost INNER JOIN tblSummary ON tblCost.fkSum = tblSummary.pkey
WHERE (((tblCost.strType)=”Black Jack”))
GROUP BY tblCost.fkSum;
and saved it as sqSumCostsCards. This query does in fact provide me with the correct dollar amount for each “key” record. I then use the above query in the below query.
UPDATE tblSummary INNER JOIN sqSumCostsCards ON tblSummary.pkey = sqSumCostCards.fkSum SET tblSummary .curCards = [sqSumCostsCards ]![SumOfcurAmount];
When I run the second query, I get a message stating that “Operation must use an updatable query”
Is there a better approach? What am I missing?
Thanks in advance for your assistance.
Ken