有两种产品分别为AA,BB,AA库存量为0,BB库存量还有50。在“销售出库”窗体中我想如果库存量小于0
时就弹出对话框要求进货,要怎样做呢????
我是这样写的代码,但是不行,请各位高手帮忙看一下
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error Resume Next
Dim KC, oldck
KC = DLookup("现有库存", "现有库存", "[产品名称]='" & Me.产品ID & "'")
oldck = Nz(Me.出货数量.OldValue, 0)
KC = KC + oldck - Me.出货数量
If KC < 0 Then
MsgBox "库存无法满足销售要求,请查证!"
Me.Undo
Cancel = True
ElseIf KC = 0 Then
MsgBox "库存已耗尽,请补充!"
End If
End Sub