Run Update query within VBA code

前端 未结 2 783
礼貌的吻别
礼貌的吻别 2021-01-19 11:16

I am trying to make a small inventory program using Access but I don\'t have much knowledge, whatever I have done so far is by googling stuff. I Have managed to make code to

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 11:27

    db.Execute "UPDATE Transaction SET Stock_Qty = Stock_Qty - " & Val(Me!Text25) _
    & " WHERE Stock_PartNo = '" & Me!Combo52 _
    & "' AND Stock_Location = '" & fromLocation & "'", dbFailOnError
    
    db.Execute "UPDATE Transaction SET Stock_Qty = Stock_Qty + " & Val(Me!Text25) _
    & " WHERE Stock_PartNo = '" & Me!Combo52 _
    & "' AND Stock_Location = '" & toLocation & "'", dbFailOnError
    

    Refer the link here for example code.

提交回复
热议问题