A
andrew
Hi
I am trying to update a table from a query with an update query. The source
query is an aggreagate query. My update query is:
UPDATE tblEquipment AS E
INNER JOIN qryComponentTotals CT
ON E.lngEquipmentID = CT.lngEquipmentID
SET
E.curCostPrice = CT.CompCost ,
E.curSalePrice = CT.CompSale
WHERE E.lngEquipmentID IN (
SELECT lngEquipmentID
FROM tblEquipmentDetails);
My source query is:
SELECT
E.lngEquipmentID,
SUM(E2.curCostPrice * ED.sngQty) AS CompCost,
SUM(E2.curSalePrice - E2.curAdjustment) AS CompSalePreAdjust,
SUM(E2.curSalePrice * ED.sngQty) AS CompSale,
SUM(E2.curSalePrice * ED.sngQty) + E.curAdjustment AS CompSalePlusAdjust
FROM (
tblEquipment E
INNER JOIN tblEquipmentDetails ED
ON E.lngEquipmentID = ED.lngEquipmentID)
INNER JOIN tblEquipment E2
ON ED.lngEquipmentID2 = E2.lngEquipmentID
WHERE ED.ysnDataType = Yes
GROUP BY
E.lngEquipmentID,
E.curAdjustment;
I get the error "Operation must use an updatable query". I am not trying to
update the query, I want to update the table using data from the query. Can
anyone tell me how to get round this?
Thanks
I am trying to update a table from a query with an update query. The source
query is an aggreagate query. My update query is:
UPDATE tblEquipment AS E
INNER JOIN qryComponentTotals CT
ON E.lngEquipmentID = CT.lngEquipmentID
SET
E.curCostPrice = CT.CompCost ,
E.curSalePrice = CT.CompSale
WHERE E.lngEquipmentID IN (
SELECT lngEquipmentID
FROM tblEquipmentDetails);
My source query is:
SELECT
E.lngEquipmentID,
SUM(E2.curCostPrice * ED.sngQty) AS CompCost,
SUM(E2.curSalePrice - E2.curAdjustment) AS CompSalePreAdjust,
SUM(E2.curSalePrice * ED.sngQty) AS CompSale,
SUM(E2.curSalePrice * ED.sngQty) + E.curAdjustment AS CompSalePlusAdjust
FROM (
tblEquipment E
INNER JOIN tblEquipmentDetails ED
ON E.lngEquipmentID = ED.lngEquipmentID)
INNER JOIN tblEquipment E2
ON ED.lngEquipmentID2 = E2.lngEquipmentID
WHERE ED.ysnDataType = Yes
GROUP BY
E.lngEquipmentID,
E.curAdjustment;
I get the error "Operation must use an updatable query". I am not trying to
update the query, I want to update the table using data from the query. Can
anyone tell me how to get round this?
Thanks