📄 f密码维护.frm
字号:
VERSION 5.00
Begin VB.Form F密码维护
Caption = "密码维护"
ClientHeight = 2895
ClientLeft = 60
ClientTop = 450
ClientWidth = 4185
LinkTopic = "Form1"
ScaleHeight = 2895
ScaleWidth = 4185
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "密码维护"
Height = 2775
Left = 0
TabIndex = 0
Top = 0
Width = 4095
Begin VB.CommandButton CmdCancel
BackColor = &H00C0C0C0&
Caption = "取消(&Q)"
Height = 360
Left = 2040
Style = 1 'Graphical
TabIndex = 13
Top = 2280
Width = 800
End
Begin VB.CommandButton CmdOk
BackColor = &H00C0C0C0&
Caption = "确定(&O)"
Height = 360
Left = 960
Style = 1 'Graphical
TabIndex = 12
Top = 2280
Width = 800
End
Begin VB.TextBox txtOld
Height = 345
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 1845
End
Begin VB.TextBox txtNew
Height = 345
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 3
Top = 1200
Width = 1845
End
Begin VB.TextBox txtCheck
Height = 345
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 2
Top = 1680
Width = 1845
End
Begin VB.TextBox txtUserId
Height = 345
IMEMode = 3 'DISABLE
Left = 1440
MaxLength = 10
TabIndex = 1
Top = 240
Width = 1845
End
Begin VB.Label Label3
Caption = "10位"
ForeColor = &H000000FF&
Height = 375
Index = 1
Left = 3360
TabIndex = 11
Top = 1200
Width = 495
End
Begin VB.Label Label4
Caption = "10位"
ForeColor = &H000000FF&
Height = 375
Left = 3360
TabIndex = 10
Top = 720
Width = 495
End
Begin VB.Label lblLabels
Caption = "用户ID(&U):"
Height = 270
Index = 0
Left = 360
TabIndex = 9
Top = 270
Width = 1080
End
Begin VB.Label lblLabels
Caption = "旧密码(&P):"
Height = 270
Index = 1
Left = 360
TabIndex = 8
Top = 720
Width = 1080
End
Begin VB.Label Label1
Caption = "新密码(N)"
Height = 375
Left = 360
TabIndex = 7
Top = 1200
Width = 855
End
Begin VB.Label Label2
Caption = "确认密码:"
Height = 375
Left = 360
TabIndex = 6
Top = 1680
Width = 975
End
Begin VB.Label Label3
Caption = "10位"
ForeColor = &H000000FF&
Height = 375
Index = 0
Left = 3360
TabIndex = 5
Top = 240
Width = 495
End
End
End
Attribute VB_Name = "F密码维护"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SQL As String
Dim msg As String
Private Sub CmdOK_Click()
Dim rst As ADODB.Recordset
Dim UserID As String '保存用户的ID
Dim pOld As String '保存用户的密码
Dim pNew As String '保存用户的新密码
Dim pCheck As String '保存用户的确认密码
'赋值
pOld = Trim(txtOld.Text)
pNew = Trim(txtNew.Text)
pCheck = Trim(txtCheck.Text)
UserID = Trim(txtUserId.Text)
SQL = "select 用户ID,用户名称,密码 from 用户信息表 where 用户ID='" & UserID & "'"
SQL = SQL & " and 密码='" & pOld & "'"
On Error GoTo ErrMsg
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount > 0 Then '如果存在这个用户
'检查新密码和确认密码
If (pCheck <> pNew) Then
MsgBox ("两次输入的密码不一致!")
Exit Sub
End If
'接受新的密码
rst.Fields("密码") = pNew
rst.Update
MsgBox ("更新成功!")
Else
MsgBox ("用户ID或密码输入错误!")
Exit Sub
End If
Exit Sub
ErrMsg:
MsgBox Err.Description, vbExclamation, "出错"
End Sub
Private Sub cmdCancel_Click()
'退出操作
人事管理系统.Enabled = True
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
'退出操作
人事管理系统.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -