老师和大神,
我有段修改事件的代码,本来在本机上运行是没有问题的,现在放到SQLSEVER上运行后,点保存按钮后,提示3157的错误,错误代码是在rst.update上,应该如何解决呀?
Private Sub Command1_Click()
Dim rst As Object
Dim strsql As String
Dim currentid As Long
Dim strfrm As String
If IsNull(Me.注册证书代码) Then
MsgBox " 注册证书代码!", vbCritical, " 提示 "
Me.注册证书代码.SetFocus
Exit Sub
End If
currentid = Form_frm_zhuceb.Form.注册表ID
strsql = " select * from 员工注册表 where 注册表ID=" & currentid & ""
Set rst = CurrentDb.OpenRecordset(strsql, dbOpenDynaset, dbSeeChanges)
rst.MoveFirst
rst.Edit
rst!员工ID = Me.员工ID
rst!注册证书代码 = Me.注册证书代码
rst!注册表ID = Me.注册表ID
rst.Update
rst.Close
Set rst = Nothing
DoEvents
strfrm = Form_frm_ygmain!员工注册表.SourceObject
Form_frm_ygmain!员工注册表.SourceObject = strfrm
DoCmd.Close acForm, "frm_zhucebedit"
End Sub
Private Sub Command1_Click()
Dim rst As Object
Dim strsql As String
Dim currentid As Long
Dim strfrm As String
If IsNull(Me.注册证书代码) Then
MsgBox " 注册证书代码!", vbCritical, " 提示 "
Me.注册证书代码.SetFocus
Exit Sub
End If
currentid = Form_frm_zhuceb.Form.注册表ID
strsql = " select * from 员工注册表 where 注册表ID=" & currentid & ""
Set rst = CurrentDb.OpenRecordset(strsql, dbOpenDynaset, dbSeeChanges)
rst.MoveFirst
rst.Edit
rst!员工ID = Me.员工ID
rst!注册证书代码 = Me.注册证书代码
'rst!注册表ID = Me.注册表ID
rst.Update
Me.注册表ID=rst!注册表ID
rst.Close
Set rst = Nothing
DoEvents
strfrm = Form_frm_ygmain!员工注册表.SourceObject
Form_frm_ygmain!员工注册表.SourceObject = strfrm
DoCmd.Close acForm, "frm_zhucebedit"
End Sub
不知这样可行。
总记录:1篇 页次:1/1 9 1 :