|
2#
楼主 |
发表于 2007-8-19 10:51:01
|
只看该作者
工序编号的代码
Private Sub 工序编号_AfterUpdate()
Me.工人工序 = Me.工序编号.Column(1)
Me.工价 = Me.工序编号.Column(2)
End Sub
==========================================
保存按扭的代码
Private Sub 保存到帮面领取表_Click()
On Error GoTo Err_保存到帮面领取表_Click
If Nz([工人编号]) = "" Or Nz([工人工序]) = "" Then
MsgBox "工人编号、工人工序不能为空!", 64, "信息提示"
Else
If MsgBox("你确定要保存吗?", vbYesNo + 32, "提示信息") = vbYes Then
DoCmd.SetWarnings False
If IsNull(Me.领取ID) = True Then
DoCmd.RunSQL "insert into 帮面领取表(帮面ID,领取日期,工人编号,工人姓名,工序编号,工人工序,数量,工价) select[帮面ID],[领取日期],[工人编号],[工人姓名],[工序编号],[工人工序],[数量],[工价]"
Else
DoCmd.RunSQL "update 帮面领取表 set 帮面ID=Forms![帮面领取窗]![帮面ID],领取日期=Forms![帮面领取窗]![领取日期],工人编号=Forms![帮面领取窗]![工人编号],工人姓名=Forms![帮面领取窗]![工人姓名],工序编号=Forms![帮面领取窗]![工序编号],工人工序=Forms![帮面领取窗]![工人工序],数量=Forms![帮面领取窗]![数量],工价=Forms![帮面领取窗]![工价] WHERE (((帮面领取表.领取ID)=[Forms]![帮面领取窗]![领取ID]));"
End If
DoCmd.SetWarnings True
Me![领取分配子窗体].Requery
Me![帮面领取数据透视子窗].Requery
Me.工人编号 = Null
Me.工人姓名 = Null
Me.工序编号 = Null
Me.工人工序 = Null
Me.数量 = Null
Me.工价 = Null
Me.领取ID = Null
Me.小计 = Null
End If
End If
Exit_保存到帮面领取表_Click:
Exit Sub
Err_保存到帮面领取表_Click:
MsgBox err.Description
Resume Exit_保存到帮面领取表_Click
Me.领取分配子窗体.Form.Recordset.MoveLast
End Sub |
|