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’
是什么错误?请各位大侠帮帮忙!
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’
是什么错误?请各位大侠帮帮忙!
解决方案 »
- 谁有全套MSGBOX 0+48 这样的代码啊
- 运行exe的时候,如何把焦点转到已经运行的程序上?
- vb 操作网页,提交表单三次产生的问题,请大家指教!
- =========== 如何取出 SQL Server 服务器里 所有的数据库名 ? =============
- listview.view = lvwReport时内容如何分行显示??
- 关于窗体左上解的系统菜单?
- 急 急 急
- UNIX服务器WINDOWS客户端用VB的FTP编程如何实现删除服务器上的多个文件?在线等待
- VB ActiveX EXE 问题,不太难
- msdn的问题!(30分)
- VB6.0+OO4O+pl/sql+调用存储过程=不会!
- 代码框 光标问题
txtPWD
的 TextBox 控件!
我测试的txtPWD.SetFocus没问题
倒是cmbStatus.SetFocus这个有问题
如果等于 False,则会出现错误。
txtPWD控件中没有index值,只是用pictureBox模拟的Data中有index值
Dim txtPWD As New Recordset
的时候是要求对象的错误!加了之后就是:未找到方法或数据成员。
错误!
晕了,加这个干什么?txtPWD 应该是一个控件,应该是textbox控件,到窗体上找
这段代码就是:要求对象 实时错误‘424’ ---
Dim txtPWD As New Recordset 这句话不要,或者换个名称。
txtPWD.SelStart = 0
txtPWD.SelLength = Len(txtPWD)
这几个前面都加上所在的窗体名试试