|
4#
楼主 |
发表于 2006-6-15 05:31:00
|
只看该作者
Private Sub Command28_Click() '新增物料事件
On Error GoTo Err_Command28_Click
If IsNull(实际采购量) Then
MsgBox "请输入采购数量,否则不能添加数据", vbInformation, "提示"
Cancel = -1
End If
If [Forms]![采购单]![审核] = -1 Then
MsgBox "此单已审核,不能新增数据", vbCritical, "警告"
Exit Sub
Else
DoCmd.GoToRecord , , acNewRec
DoCmd.SetWarnings False
DoCmd.OpenQuery "库存清单更新"
'Me.List26.Requery
'Me.List78.Requery
End If
Me.List29.Requery
Me.List26.SetFocus
Exit_Command28_Click:
Exit Sub
Err_Command28_Click:
MsgBox Err.Description
Resume Exit_Command28_Click
End Sub
Private Sub List26_Click() '列表框单击事件
Dim a As Integer
a = MsgBox("是否添加此笔数据到采购单中", vbOK + vbQuestion, "提示")
If a = vbOK Then
Me.订单号 = List26.Column(0)
Me.产品代号 = List26.Column(8)
Me.材料编号 = List26.Column(9)
Me.材料名称 = List26.Column(3)
Me.规格 = List26.Column(4)
Me.记账单位 = List26.Column(5)
Me.数量 = List26.Column(7)
Me.客户编号 = List26.Column(10)
Me.采购单价.SetFocus
Me.采购单价 = Me.单价
Me.库存 = DLookup("[数量]", "库存清单", "[材料编号]=" & 材料编号.Value)
Me.随机库存 = IIf(Nz([库存数量], 0) - Nz([数量], 0) < 0, "0", Nz([库存数量], 0) - Nz([数量], 0))
Me.实际采购量 = IIf(Nz([数量], 0) - Nz([库存数量], 0) < 0, "0", Nz([数量], 0) - Nz([库存数量], 0))
End If
End Sub
|
|