Microsoft
Software
Hardware
Network
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
"CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#". Both tables have a multiple column PK set consisting of paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumbe
r & 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.PaysheetTypeNumbe
r & 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]+[CallC
enterPayme
ntPendingU
pdate_Pays
heet_Sourc
e#].[NumPa
yments]
WHERE
cstr(paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumbe
r & Paysheet.ReportDate & Paysheet.ItemNumber)
in
(
SELECT cstr(paysheet.techID & Paysheet.Region & Paysheet.PaysheetTypeNumbe
r & Paysheet.ReportDate & Paysheet.ItemNumber)
FROM
paysheet INNER JOIN [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#] ON [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].TechID
=
Paysheet.TechID
AND [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Region
= Paysheet.Region
AND [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Payshe
etTypeNumb
er = Paysheet.PaysheetTypeNumbe
r
AND [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Report
Date = Paysheet.ReportDate
AND [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].ItemNu
mber = Paysheet.ItemNumber)
Which gives me an prompt box because it does not know what [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].[NumPa
yments] is.
So I tried this query:
UPDATE Paysheet INNER JOIN [CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#] ON (Paysheet.Region =
[CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Region
) AND (Paysheet.PaysheetTypeNumb
er =
[CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Payshe
etTypeNumb
er) AND (Paysheet.TechID =
[CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].TechID
) AND (Paysheet.ReportDate =
[CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].Report
Date) AND (Paysheet.ItemNumber =
[CallCenterPaymentPendingU
pdate_Pays
heet_Sourc
e#].ItemNu
mber) SET Paysheet.Amount =
[paysheet].[Amount]+DLookU
p("NumPaym
ents","Cal
lCenterPay
mentPendin
gUpdate_Pa
ysheet_Sou
rce#","Reg
ion = " & Paysheet.Region & " AND
techID = " & Paysheet.techID & " AND PaysheetTypeNumber = " & Paysheet.PaysheetTypeNumbe
r & " 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
SCCM Remote Tools: Now it works... now it doesn't
vb.net - panel title
Access 2007 - Reports Problem - SP2 - RecordSource Property
Silverlight Runtime not loading XAP from Integrated Authentication
Receiving error when submitting data to SQL Server through asp.net vb
Microsoft, Access, 2000 Is there a way to code a Freeze pane in a datasheet form?
Error opening excel files: "Windows cannot find 'C:\Users\Ryan\Desktop\xxx<wbr />xexcel file namexxx'.
WSUS Running
Scope_Identity in SELECT statement with a WHERE clause
Recalc field on an open form when close a second form.