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
windows 7 offline files: the process cannot access the file because it is being used by another process offline
How to make dropdown disappear using code
Code not returning result unless a breakpoint is set!
How to enable hibernate acpi in xp 64 bit on dell optiplex 760
My Outlook keeps Crashing with this Event ID's 2000, 2002, 1000? Thanx for the help
recovering *Contacts* from an old .OST file???
Returning bitmap DPI in MFC
Installed vs total physical memory
Select MAX(ISNULL(variable, 0)) is returning NULL when it should be returning 0
Windows Bad Image Error