I have an Access database with an item table "VendorItem" with (ID, Vendor, Price) Fields and another "ItemPrice" with (ItemName, AveragePrice) Fields.
I want to run an SQL query that will update the average price of the item from a specific vendor, let's say 'xxx'.
The error I get is "Operation must use an updateable query". This code is simple but I haven't been able to find the cause of this error. How could I change the string to get what I want?
I have:
Sub MP()
Dim strSQL As String
strSQL = "UPDATE ItemPrice SET AveragePrice=(SELECT AVG(Price) FROM VendorItem WHERE Vendor='xxx') WHERE ItemName='xxx'"
DoCmd.RunSQL strSQL
End Sub