Private Sub cmd_Save() Dim rst As DAO.Recordset If IsNull(Me.cslb) Then MsgBox "请输入厂商联系人!", vbCritical, "提示:" Me.cslb.SetFocus Exit Sub End If If IsNull(Me.cslxra) Then MsgBox "请输入厂商联系人!", vbCritical, "提示:" Me.cslxra.SetFocus Exit Sub End If If IsNull(Me.cstela) Then MsgBox "请输入厂商联系电话!", vbCritical, "提示:" Me.cstela.SetFocus Exit Sub End If If IsNull(Me.csgsmc) Then MsgBox "请输入厂商公司名称!", vbCritical, "提示:" Me.csgsmc.SetFocus Exit Sub End If If IsNull(Me.csjylx) Then MsgBox "请输入厂商经营产品类型!", vbCritical, "提示:" Me.csjylx.SetFocus Exit Sub End If Me.Refresh If Acchelp_StrDataIsExist("tblCslxzl", " csgsmc", Me.csgsmc) = True Then MsgBox "你输入的数据已经存在,请重新输入", vbCritical, "警告" Me.csgsmc.SetFocus Exit Sub End If If MsgBox("您确认要保存吗?", vbOKCancel + vbInformation, "提示") = vbOK Then Set rst = CurrentDb.OpenRecordset("tblCslxzl", dbOpenDynaset) rst.AddNew rst("csId") = acchelp_autoid("CS", 4, "tblCslxzl", "csId") rst("cslb") = Me.cslb rst("cslxra") = Me.cslxra rst("cslxrb") = Me.cslxrb rst("cstela") = Me.cstela rst("cstelb") = Me.cstelb rst("csfax") = Me.csfax rst("csgsmc") = Me.csgsmc rst("csjylx") = Me.csjylx rst.Update rst.Close Set rst = Nothing '刷新数据 If IsLoaded("usysfrmMain") Then DoCmd.Echo False Forms!usysfrmMain!frmChild.SourceObject = "frmcslxzl_child" DoCmd.Echo True End If MsgBox "保存成功!", vbInformation, "提示" Me.cslb = Null Me.cslxra = Null Me.cslxrb = Null Me.cstela = Null Me.cstelb = Null Me.csfax = Null Me.csgsmc = Null Me.csjylx = Null End If End Sub 黄色部分就是提示出错。 在新增数据的时候点保存就出现这个错误 错误代码为:3058 索引或主关键字不能包含一个空(NULL)值 还缺一个文件,要等明天才能传上了!
kg8aVXUF.rar
(244.14 KB, 下载次数: 8)
[此贴子已经被作者于2007-5-10 21:06:28编辑过] |