|
我有段代码,,,以前是弄成“工序”不允许重复,
现在想实现“工序”都可以重复,请教,要如何修改下面这段代码?
Private Sub 保存工序工价_Click()
On Error GoTo Err_保存工序工价_Click
If Nz([工序编号]) = "" Then
MsgBox "工序编号不能为空!", 64, "信息提示"
Else
DoCmd.SetWarnings False
If IsNull(帮面工序ID) = True Then
If DCount("帮面工序ID", "工价", "工序='" & Me.工序 & "' and 帮面ID='" & Me.帮面ID & "'") > 0 Then
MsgBox "工序有重复,请重新选择……"
Me.工序.SetFocus
Else
DoCmd.RunSQL "insert into 工价(工序编号,工序,工价,帮面ID) select [Forms]![帮面指令录入窗]![工序编号],[Forms]![帮面指令录入窗]![工序],[Forms]![帮面指令录入窗]![工价],[Forms]![帮面指令录入窗]![帮面ID];"
Me.帮面工序子窗体.Requery
' MsgBox "添加成功"
Me.工序 = Null
Me.工价 = Null
Me.工序编号 = Null
Me.帮面工序ID = Null
'Me.帮面ID = Null
End If
Else
DoCmd.RunSQL "UPDATE 工价 SET 工价.工序编号 = [Forms]![帮面指令录入窗]![工序编号], 工价.工序 = [Forms]![帮面指令录入窗]![工序], 工价.工价 = [Forms]![帮面指令录入窗]![工价] WHERE (((工价.帮面工序ID)=[Forms]![帮面指令录入窗]![帮面工序ID]));"
Me.帮面工序子窗体.Requery
' MsgBox "修改成功"
End If
DoCmd.SetWarnings True
End If
Exit_保存工序工价_Click:
Exit Sub
Err_保存工序工价_Click:
MsgBox Err.Description
Resume Exit_保存工序工价_Click
End Sub
[ 本帖最后由 goto2008 于 2007-12-26 09:24 编辑 ] |
|