|
对于子窗体入库完成,主窗体订单状态锁定问题"
1子窗体的收货数量=订单数量,后行状态锁定,如果整个订单明细都完成入库,这个订单状态就锁定
请帮助看看下面代码如何增加,谢谢
Private Sub Qty_receive_AfterUpdate()
On Error GoTo Err_Qty_receive_AfterUpdate '20131106 重新定义收货方法
'Qty_receive
Dim x As Integer
Dim y As Long
Dim SQLText As String
Dim Step As Integer
If Me.Qty_receive = 0 Then Exit Sub
x = Me.Received_TotalofQty + Me.Qty_receive
If x > Me.Qty_Order Then '收货数量>订单数量
MsgBox "收货数量合计已超过本单订货数量。请重新输入。", vbCritical, "提示"
Me.Qty_receive = 0
x = 0
Me.Qty_Order.SetFocus
Me.Qty_receive.SetFocus
Exit Sub
End If
If x = Me.Qty_Order Then '收货数量=订单数量
Step = 1
SQLText = "UPDATE [tblProduct_Stock_Remote] SET [tblProduct_Stock_Remote].[Real_Qty] =Forms![frmPurchase_Order]![SubPo].Form![Qty_receive]+[tblProduct_Stock_Remote]![Real_Qty]WHERE ((([tblProduct_Stock_Remote].[ITEM])=Forms![frmPurchase_Order]![SubPo].Form![Parts No]));"
DoCmd.RunSQL SQLText
Step = 2
SQLText = "INSERT INTO [tblStockIn/Out_Remote] ( [Item], [Date], In_Out, [ID Motive], Quantity)" 'NOTE
SQLText = SQLText + "SELECT Forms![frmPurchase_Order]![SubPo].Form![Parts No] AS [Item], date() AS [Date], 'I' AS [IN_Out], '03' AS [ID Motive], Forms![frmPurchase_Order]![SubPo].Form![Qty_receive] AS [Quantity];" ',Forms![frmPurchase_Order]![SubPo].Form![TEXT20] AS [NOTE];"
DoCmd.RunSQL SQLText
' SQLText = "INSERT INTO [tblStockIn/Out_Remote] ([note])"
' SQLText = SQLText + "SELECT Forms![frmPurchase_Order]![PO_No] AS [Quantity];"
DoCmd.RunSQL SQLText
Me.Received_TotalofQty = x
Me.No_Receving_Qty = [Qty_Order] - [Received_TotalofQty]
Me.Received_Date = Date
Me.Qty_receive = 0
Me.Received_TotalofQty.SetFocus
' Me.Qty_receive.Enabled = False
Me.Receive_Status.Locked = True
MsgBox "这个物料已完成收货"
Else '收货数量<订单数量
y = MsgBox("收货数量小于本单订货数量,是否确定属于分批收货?", vbYesNo + vbQuestion, "提示")
If y = vbNo Then
Me.Qty_Order.SetFocus
Me.Qty_receive.SetFocus
x = 0
Exit Sub
Else
Step = 1
SQLText = "UPDATE [tblProduct_Stock_Remote] SET [tblProduct_Stock_Remote].[Real_Qty] =Forms![frmPurchase_Order]![SubPo].Form![Qty_receive]+[tblProduct_Stock_Remote]![Real_Qty]WHERE ((([tblProduct_Stock_Remote].[ITEM])=Forms![frmPurchase_Order]![SubPo].Form![Parts No]));"
DoCmd.RunSQL SQLText
Step = 2
SQLText = "INSERT INTO [tblStockIn/Out_Remote] ( [Item], [Date], In_Out, [ID Motive], Quantity)" 'NOTE
SQLText = SQLText + "SELECT Forms![frmPurchase_Order]![SubPo].Form![Parts No] AS [Item], date() AS [Date], 'I' AS [IN_Out], '03' AS [ID Motive], Forms![frmPurchase_Order]![SubPo].Form![Qty_receive] AS [Quantity];" ',Forms![frmPurchase_Order]![SubPo].Form![TEXT20] AS [NOTE];"
DoCmd.RunSQL SQLText
Me.Received_TotalofQty = x
Me.No_Receving_Qty = [Qty_Order] - [Received_TotalofQty]
Me.Received_Date = Date
'Me.Qty_receive = 0
End If
End If
Me.Qty_receive = 0
Me.Requery
Exit_Qty_receive_AfterUpdate:
Exit Sub
Err_Qty_receive_AfterUpdate:
Resume Exit_Qty_receive_AfterUpdate
'xxxxxxxxxxxxxxxxxxxxxxxxxxxx
If Me.Qty_receive = "" Then
Me!Received_Date = ""
Else
Me!Received_Date = Date
End If
If Me.Received_TotalofQty = Me.Qty_Order Then
Me.Receive_Status.Locked = True
Else
Me.Receive_Status.Locked = False
End If
End Sub
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|