我是新手。我想用一张表来存储并提供成品的实时库存水平。如果具有新LotNo的产品将创建新的原始,否则它将该产品的数量添加到现有项目。这是我的代码:
Private Sub Command92_Click()
Dim RC As Integer
RC = DCount("[Finished_Product]", "tbl_Finished_Product_Inventory", "[Finished_Product]= " & Me!cboFinishedProduct & " AND [LotNo]= '" & Me!cboFinishedProduct.Column(5) & " '")
If RC = 0 Then
CurrentDb.Execute " INSERT INTO tbl_Finished_Product_Inventory(Finished_Product, LotNo, Quarantined_Qty, Stock_Unit, LastUpdate) VALUES (" & Me!cboFinishedProduct & ", '" & Me!cboFinishedProduct.Column(5) & "', " & CStr(Me!txtLiberatedQty) & ",'" & Me!txtUnit & "', Now())"
Else
CurrentDb.Execute " UPDATE tbl_Finished_Product_Inventory SET Quarantined_Qty = Qurantined_Qty + " & CStr(Me!txtLiberatedQty) & ", LastUpdate = Now() WHERE Finished_Product = " & Me!cboFinishedProduct & " AND LotNo = '" & Me!txtLot & "' "
End If
MsgBox (" You have successfully updated ONE RECORD in tbl_Finished_Product_Inventory")
End Sub
请帮我检查一下我的错误。
感谢
江州