高手请指教,谢谢
Private Sub cmdSave_Click()
Dim objCopy As New Recordset
If Len(Trim(txtUser)) <> 5 Then
MsgBox "用户编号必须为5位字符串!", vbCritical, "系统用户管理"
txtUser.SetFocus
txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser)
ElseIf Len(Trim(txtPWD)) <> 6 Then
MsgBox "用户口令必须为6位字符串!", vbCritical, "系统用户管理"
txtPWD.SetFocus
txtPWD.SelStart = 0
txtPWD.SelLength = Len(txtPWD)
ElseIf Not cmbStatus Like "[0,1,2,3,4]" Then
MsgBox "用户权限代码必须为0、1、2、3或4!", vbCritical, "系统用户管理"
cmbStatus = "": cmbStatus.SetFocus
Else
Set objCopy = Drug_Store.rsSysUsers.Clone
With objCopy
If .RecordCount > 0 Then
.MoveFirst
.Find "编号=""&Trim(txtUser)&"""
If Not .EOF And .AbsolutePosition <> _
Drug_Store.rsSysUsers.AbsolutePosition Then
MsgBox "编号:" & Trim(txtUser) & _
"已被使用,请使用其他用户名!", _
vbCritical, "系统用户管理"
txtUser.SetFocus
txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser)
Exit Sub
End If
End If
End With
Drug_Store.rsSysUsers.Update
MsgBox "数据保存成功!", vbInformation, "系统用户管理"
cmdAdd.Enabled = True
cmdDelete.Enabled = True
isAding = False
picNavigation.Enabled = True
End If
End Sub
要求对象 实时错误‘424’
是什么错误?请各位大侠帮帮忙!
[解决办法]
如果是因为禁用,那错误提示是“无效的过程调用或参数”而不是“要求对象”。
“要求对象”说明引用的对象是不存在的!
我最怀疑的是楼主把控件名称搞错了。
[解决办法]
[解决办法]
txtPWD所在窗体名.txtPWD.SetFocus 试试。
Dim txtPWD As New Recordset 这句话不要,或者换个名称。
[解决办法]
txtPWD.SetFocus
txtPWD.SelStart = 0
txtPWD.SelLength = Len(txtPWD)
这几个前面都加上所在的窗体名试试