|
本帖最后由 rendiule01 于 2023-5-27 14:52 编辑
是条形码没有完成录入,就跑到qty控件录入数量 此时弹出提示信息 “在不使用AddNew或Edit的情况下,更新(Update)或取消更新(CancelUpdate)” 之后就是整个窗体卡住了,死机无法动弹了,根本没法条形码再次获得焦点
Private Sub PRD_NO_AfterUpdate() '品号更新后事件
Me.Dirty = False '允许更新
Me![prd_name] = Me!prd_no.Column(1)
Me![wh] = Me!prd_no.Column(2)
'Me![up] = 0
Me![zk] = 100
Me![ut] = Me!prd_no.Column(4)
Me![tax] = Me![prd_no].Column(5)
Me![tax_id] = Me.Parent![tax_id]
Me![NW] = Nz(Me![prd_no].Column(6), 0)
If IsNull(Me![KW]) Then
Me![KW] = Me!prd_no.Column(3)
Me![prd_wh_kw] = Me![prd_no] + Me![wh] + Me![KW]
Me![qty_wh] = Nz(DLookup("qty_wh", "WL_TF", "prd_no='" & Me!prd_no.Column(0) & "' and wh='" & Me![wh] & "' and kw=" & SQLTEXT(Me![KW])), 0) '库存数量
End If
Me![qty] = 0
Me![qty].SetFocus
Me.Dirty = False '允许更新
End Sub
Private Sub Form_Error(DataErr As Integer, Response As Integer) '窗体出错事件
Const conDuplicateKey = 3022
Dim strprd_wh_kw As String
strprd_wh_kw = Nz(Me.prd_wh_kw)
Debug.Print DataErr
If DataErr = conDuplicateKey Then
Response = acDataErrContinue
MsgboxEx "同样的品号、仓库、库位不能重复添加,请直接修改出库数量。", vbExclamation + vbOKOnly, AryouStr, 3000
Me.Undo
'Me!kw = Null
Me.Recordset.MoveFirst
Me.Recordset.FindFirst "prd_wh_kw=" & SQLTEXT(strprd_wh_kw)
Me.qty.SetFocus
End If
End Sub
Private Sub qty_AfterUpdate()
If Me![qty].value > 0 Then
If Not IsNull(Me![wh]) And Not IsNull(Me![prd_no]) And Not IsNull(Me![KW]) Then
Me![prd_wh_kw] = Me![prd_no] + Me![wh] + Me![KW]
Me![qty_wh] = Nz(DLookup("qty_wh", "WL_TF", "prd_no=" & SQLTEXT(Me![prd_no]) & " and wh=" & SQLTEXT(Me![wh]) & " and KW=" & SQLTEXT(Me![KW])), 0)
End If
End If
End Sub
Private Sub qty_LostFocus()
Me![up].SetFocus
End Sub
|
|