📄 密码.frm
字号:
VERSION 5.00
Begin VB.Form mima
Caption = "修改密码"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 1080
TabIndex = 7
Top = 2280
Width = 975
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 2520
TabIndex = 6
Top = 2280
Width = 975
End
Begin VB.TextBox txtConfirm
Height = 270
Left = 2160
TabIndex = 5
Top = 1680
Width = 1455
End
Begin VB.TextBox txtNew
Height = 270
Left = 2160
TabIndex = 4
Top = 1200
Width = 1455
End
Begin VB.TextBox txtOld
Height = 270
Left = 2160
TabIndex = 3
Top = 720
Width = 1455
End
Begin VB.Label lblConfirmPass
Caption = "确认新密码:"
Height = 255
Left = 840
TabIndex = 2
Top = 1680
Width = 1095
End
Begin VB.Label lblNewPass
Caption = "新密码:"
Height = 255
Left = 840
TabIndex = 1
Top = 1200
Width = 1095
End
Begin VB.Label lblOldPass
Caption = "旧密码:"
Height = 255
Left = 840
TabIndex = 0
Top = 720
Width = 1095
End
End
Attribute VB_Name = "mima"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
If txtOld.Text = "" Then
FoundErr = True
ErrMsg = ErrMsg & vbCr & "●旧密码不能为空!"
txtOld.SetFocus
ElseIf txtNew.Text = "" Then
FoundErr = True
ErrMsg = ErrMsg & vbCr & "●新密码不能为空!"
txtNew.SetFocus
ElseIf txtConfirm.Text = "" Then
FoundErr = True
ErrMsg = ErrMsg & vbCr & "●确认密码不能为空!"
txtConfirm.SetFocus
ElseIf txtConfirm.Text <> txtNew.Text Then
FoundErr = True
ErrMsg = ErrMsg & vbCr & "●确认密码和新密码不一致!"
txtNew.Text = ""
txtConfirm.Text = ""
txtNew.SetFocus
End If
If FoundErr = True Then
Call ShowErrMsg(ErrMsg)
FoundErr = False '还原状态
ErrMsg = "" '还原状态
Exit Sub
Else
Call OpenDB
sql = "select * from 用户登录 where 帐号='" & User & "'"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs.Fields("密码") <> txtOld.Text Then
MsgBox "●旧密码不正确,请输入正确的密码!"
txtOld.Text = ""
txtOld.SetFocus
rs.Close
Set rs = Nothing
Call CloseDB
Else
rs.Fields("密码") = txtNew.Text
rs.Update
rs.Close
Set rs = Nothing
Call CloseDB
MsgBox "密码修改成功!" & vbCr & vbCr & "记得下次登录使用新密码哟!", vbOKOnly + vbExclamation, App.Title
Unload Me
End If
End If
End Sub
Private Sub Form_Load()
Call CheckLogin(Me)
Call SetCenter(Me)
Call mimaSet(Me)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call CloseDB
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -