|
2#
楼主 |
发表于 2013-5-17 12:40:21
|
只看该作者
Private Sub 确定_Click()
If IsNull(Me!原密码文本框) Then
MsgBox "请输入原来的密码!", vbOKOnly, "请确定"
Me!原密码文本框.SetFocus
Exit Sub
End If
If IsNull(Me!新密码1文本框) Then
MsgBox "请输入新密码!", vbOKOnly, "请确定"
Me!新密码1文本框.SetFocus
Exit Sub
End If
If IsNull(Me!新密码2文本框) Then
MsgBox "请再次输入新密码!", vbOKOnly, "请确定"
Me!新密码2文本框.SetFocus
Exit Sub
End If
If StrComp(Me!新密码1文本框, Me!新密码2文本框, vbBinaryCompare) <> 0 Then
MsgBox "你两次输入的新密码不一致!", vbOKOnly, "请确定"
Me!新密码1文本框.SetFocus
Exit Sub
End If
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim SQLstring As String
SQLstring = "select * from 读者信息表 where 借书证号='" + user借书证号 + "'"
rs.Open SQLstring, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.MoveFirst
If StrComp(rs("登陆密码"), Me!原密码文本框, vbBinaryCompare) <> 0 Then
MsgBox "你输入的原密码错误!", vbOKOnly, "警告!"
Me!原密码文本框.SetFocus
Exit Sub
End If
Set rs = Nothing
Dim updatesqlstring As String
updatesqlstring = "update 读书信息表 set 登陆密码='" + Me!新密码1文本框 + "' where 借书证号='" + user借书证号 + "'"
DoCmd.SetWarnings False
DoCmd.RunSQL updatesqlstring
MsgBox "密码修改成功!", vbOKOnly, "恭喜!"
Me!原密码文本框 = ""
Me!新密码1文本框 = ""
Me!新密码2文本框 = ""
End Sub |
|