【发布时间】:2016-07-11 18:14:38
【问题描述】:
我有一个函数可以将值放入一个名为 InventoryTransaction 的表中,并且运行良好。但是,我需要使用添加到 InventoryTransaction 中的记录来更新另一个表。 但是我在尝试更新它一直给我错误的值时遇到了困难,任何指导将不胜感激
错误信息是:“Undefined function 'IT.QuantityWHERE' in expression”
Function EditTransaction(IT As InventoryTransaction, Optional CustomerOrderID, Optional PurchaseOrderID) As Boolean
Dim rsw As New RecordSetWrapper
Dim SQL As String
If rsw.OpenRecordset("InventoryTransaction", "[TransactionID] = " & IT.InventoryID) Then
With rsw.Recordset
If IT.TransactionType <= 0 Then
Exit Function
ElseIf IT.InventoryID = m_cNew_InventoryID Then
rsw.AddNew
ElseIf .EOF Then
Exit Function
Else
rsw.Edit
End If
![ItemID] = IT.ProductID
![TransactionQty] = IT.Quantity
![TransactionType] = IT.TransactionType
![LocationID] = IT.LocationID
![Time] = Now()
EditTransaction = rsw.Update
If IT.InventoryID = m_cNew_InventoryID Then
rsw.Recordset.Bookmark = rsw.Recordset.LastModified
IT.InventoryID = ![TransactionID]
End If
End With
SQL = "UPDATE Inventory " & _
"SET Inventory.Qty = Inventory.Qty + IT.Quantity" & _
"WHERE (Inventory.ItemID = IT.ProductID And Inventory.LocationID = IT.LocationID)"
DoCmd.RunSQL SQL
End If
【问题讨论】:
-
具体是什么错误?
-
糟糕,错误提示“表达式中未定义函数 'IT.QuantityWHERE'