J
Jon
Greeting,
I have the following code which apply in before update event in form, but i
have this error syntax error missing operator in query expression
‘Sum(Quantity * iif(transaction type = “additionâ€,1,-1))’. My code is as
follows:
Dim strMessage As String
Dim strCriteria As String
Dim intStockInHand As Integer
If Me.[Transaction Type] <> "addition" Then
strCriteria = "Item = """ & Me.Item & """"
intStockInHand = _
DSum("Quantity * IIf(Transaction Type = ""addition"",1,-1)",
"Inventory Transactions Extended", strCriteria)
If intStockInHand - Me.Quantity < 0 Then
strMessage = "Insufficient " & Item & " stock in hand."
MsgBox strMessage, vbExclamation, "Invalid Operation"
Cancel = True
ElseIf intStockInHand - Me.Quantity < 3 Then
strMessage = "This transaction will leave " & _
intStockInHand - Me.Quantity & " of " & Me.Item & _
" in stock." & vbNewLine & vbNewLine & _
"Do you wish to continue?"
If MsgBox(strMessage, vbQuestion + vbOKCancel, _
"Warning") = vbCancel Then
End If
End If
End If
My orginal post can be found here:
http://www.microsoft.com/office/com...&p=1&tid=46d77a20-1c41-4a87-9aaa-15c7ab80cee9
I have the following code which apply in before update event in form, but i
have this error syntax error missing operator in query expression
‘Sum(Quantity * iif(transaction type = “additionâ€,1,-1))’. My code is as
follows:
Dim strMessage As String
Dim strCriteria As String
Dim intStockInHand As Integer
If Me.[Transaction Type] <> "addition" Then
strCriteria = "Item = """ & Me.Item & """"
intStockInHand = _
DSum("Quantity * IIf(Transaction Type = ""addition"",1,-1)",
"Inventory Transactions Extended", strCriteria)
If intStockInHand - Me.Quantity < 0 Then
strMessage = "Insufficient " & Item & " stock in hand."
MsgBox strMessage, vbExclamation, "Invalid Operation"
Cancel = True
ElseIf intStockInHand - Me.Quantity < 3 Then
strMessage = "This transaction will leave " & _
intStockInHand - Me.Quantity & " of " & Me.Item & _
" in stock." & vbNewLine & vbNewLine & _
"Do you wish to continue?"
If MsgBox(strMessage, vbQuestion + vbOKCancel, _
"Warning") = vbCancel Then
End If
End If
End If
My orginal post can be found here:
http://www.microsoft.com/office/com...&p=1&tid=46d77a20-1c41-4a87-9aaa-15c7ab80cee9