|
运行下面代码总是报错如下,请高手指点迷津,不胜感激!!!!!!!!!!
Private Sub 项次_AfterUpdate()
Dim DB As Database
Dim RST, RST0 As Recordset
If IsNull([生产单号]) Then
MsgBox "请先输入 生产单号", vbInformation
[生产单号].SetFocus
Exit Sub
Else
Set DB = CurrentDb
Set RST = DB.OpenRecordset("Order", dbOpenSnapshot)
Set RST0 = DB.OpenRecordset("tblshipment A", dbOpenSnapshot)
'先查 出貨資料,再查 Porder
'出貨資料有資料,找出最後一筆
'無,則查 Porder 資料
RST0.FindFirst "[生产单号]='" & Me![生产单号] & "' and [项次]=" & Me![项次]
If RST0.NoMatch Then
RST.FindFirst "[生产单号]='" & Me![生产单号] & "' and [项次]=" & Me![项次]
If RST.NoMatch Then
MsgBox "无此生产单号,请先查证。", vbCritical
[生产单号].SetFocus
Exit Sub
Else
[客户] = RST("客户编号")
[客户款号] = RST("客户款号")
[合同号] = RST("合同号")
[订单交期] = RST("交货日期")
[颜色] = RST("颜色")
[品名规格] = RST("品名规格")
[数量] = RST("数量")
[单位] = RST("单位")
[说明] = RST("备注")
[单号] = RST("单号")
[上次余数] = [数量]
[单价] = RST("单价")
[币别] = RST("币别")
' DoCmd.OpenQuery "出货 A"
' RST![出货] = ture
End If
RST.Close
Else
[客户] = RST0("客户编号")
[客户款号] = RST0("客户款号")
[合同号] = RST0("合同号")
[订单交期] = RST0("交货日期")
[颜色] = RST0("颜色")
[品名规格] = RST0("品名规格")
[数量] = RST0("数量")
[单位] = RST0("单位")
[说明] = RST0("备注")
[单号] = RST0("单号")
[上次余数] = [数量]
[单价] = RST0("单价")
[币别] = RST0("币别")
[上次余数] = DLast("[本次余数]", "tblShipment A", "[生产单号]='" & Me![生产单号] & "' and [项次]=" & Me![项次])
End If
RST0.Close
End If
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|