Question : Problem with MS Access Update query

I am trying to create a query in MS Access that will update my PAYSHEET table with data from a table called
"CallCenterPaymentPendingUpdate_Paysheet_Source#".  Both tables have a multiple column PK set consisting of paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumber &  Paysheet.ReportDate & Paysheet.ItemNumber.

I know that the "HAVING IN SELECT" or "WHERE IN SELECT" typically users just one field to match on, but I need to link them on the combined PK  so I concatinated the fileds like so:  paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumber &  Paysheet.ReportDate & Paysheet.ItemNumber.

Because I need to link two tables I keep getting the error "Operation must use an updatable query".  SO I rewrite it using a correlated subquery.  The closest I can get to solving this problem is this query:

UPDATE Paysheet
SET Amount = [paysheet].[Amount]+[CallCenterPaymentPendingUpdate_Paysheet_Source#].[NumPayments]
WHERE
cstr(paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumber &  Paysheet.ReportDate & Paysheet.ItemNumber)
in
(
SELECT cstr(paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumber &  Paysheet.ReportDate & Paysheet.ItemNumber)
FROM
paysheet INNER JOIN  [CallCenterPaymentPendingUpdate_Paysheet_Source#]  ON [CallCenterPaymentPendingUpdate_Paysheet_Source#].TechID =
Paysheet.TechID
AND   [CallCenterPaymentPendingUpdate_Paysheet_Source#].Region = Paysheet.Region
AND   [CallCenterPaymentPendingUpdate_Paysheet_Source#].PaysheetTypeNumber = Paysheet.PaysheetTypeNumber
AND   [CallCenterPaymentPendingUpdate_Paysheet_Source#].ReportDate = Paysheet.ReportDate
AND   [CallCenterPaymentPendingUpdate_Paysheet_Source#].ItemNumber = Paysheet.ItemNumber)

Which gives me an prompt box because it does not know what [CallCenterPaymentPendingUpdate_Paysheet_Source#].[NumPayments] is.

So I tried this query:

UPDATE Paysheet INNER JOIN [CallCenterPaymentPendingUpdate_Paysheet_Source#] ON (Paysheet.Region =
[CallCenterPaymentPendingUpdate_Paysheet_Source#].Region) AND (Paysheet.PaysheetTypeNumber =
[CallCenterPaymentPendingUpdate_Paysheet_Source#].PaysheetTypeNumber) AND (Paysheet.TechID =
[CallCenterPaymentPendingUpdate_Paysheet_Source#].TechID) AND (Paysheet.ReportDate =
[CallCenterPaymentPendingUpdate_Paysheet_Source#].ReportDate) AND (Paysheet.ItemNumber =
[CallCenterPaymentPendingUpdate_Paysheet_Source#].ItemNumber) SET Paysheet.Amount =
[paysheet].[Amount]+DLookUp("NumPayments","CallCenterPaymentPendingUpdate_Paysheet_Source#","Region = " & Paysheet.Region & " AND
techID = " & Paysheet.techID & "  AND PaysheetTypeNumber = " & Paysheet.PaysheetTypeNumber & " AND ReportDate = " &
Paysheet.ReportDate & " AND ItemNumber = " & Paysheet.ItemNumber);

But I get the error "Operation must use an updatable query" again.

Help!

Answer : Problem with MS Access Update query

Have the data you want to update in a stand alone table, this should fix the error.

Carl.
Random Solutions  
 
programming4us programming4us