表:用户密码表 用户ID 用户名 密码 窗体:更改密码
1 管理员 001
2 小李 002
我在更改密码窗体的“确定”按扭代码如下:
Private Sub 确认_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim tixing As String
rs.Open "用户密码表", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Do While Not rs.EOF
If Me.用户名.Value = rs.Fields("用户名") Then
If Me.输入旧密码.Value = rs.Fields("密码") Then
If Me.输入新密码.Value <> Me.确认新密码.Value Then
Me.确认新密码.SetFocus
tixing = MsgBox("请输入正确的确认密码", 16, "警告")
ElseIf IsNull(Me.确认新密码.Value) Then
tixing = MsgBox("新密码不能为空", 16, "警告")
Else
rs.Fields("用户密码表") = Me.确认新密码.Value
tixing = MsgBox("你已成功的更改了密码!新密码为" & rs.Fields("密码"), 48, "祝贺")
End If
Else
tixing = MsgBox("你输入的旧密码有误,请重新输入!", 16, "^_^")
Me.输入旧密码.SetFocus '转移焦点
End If
End If
rs.MoveNext
Loop
End Sub
帮忙看一下上面这段代码哪里错了???
[此贴子已经被作者于2004-6-30 17:42:31编辑过]
|