I got a syntax error when I ran a sql update in access 2013. The targeted table saves inventory balance data. to update the balance, the original data will subtract the consumption amount resulted from production activities. I use a query to get the sum of consumption. My codes are as follows:
Private Sub Command4_Click()
CurrentDb.Execute ("UPDATE tbl_Current_Stock As o" & _
“Inner join preview_Of_Raw_Material_Consumption As p” & _
“On o.Raw_Material =p.[Ingredient/Packaging material]” & _
"Set o.Stock_Level = o.Stock_Level- p.SumOfConsumption" )
End Sub
EDIT - Add current code that isn't working:
CurrentDb.Execute ("UPDATE tbl_Current_Stock As o Inner join preview_Of_Raw_Material_Consumption As p On o.[Raw_Material] = p.[Ingredient/Packaging material]Set o.[Stock_Level] = o.[Stock_Level]- p.SumOfConsumption from o p")