?? formd5.frm
字號(hào):
VERSION 5.00
Begin VB.Form FormD5
BackColor = &H00FFFF80&
Caption = " 修改密碼"
ClientHeight = 4875
ClientLeft = 3855
ClientTop = 2640
ClientWidth = 9705
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 4875
ScaleWidth = 9705
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 320
Left = 4680
TabIndex = 3
Top = 2805
Width = 975
End
Begin VB.CommandButton Command1
Caption = "確 定"
Height = 320
Left = 3600
TabIndex = 2
Top = 2805
Width = 975
End
Begin VB.TextBox Text2
Height = 270
IMEMode = 3 'DISABLE
Left = 4680
PasswordChar = "*"
TabIndex = 1
Text = "Text2"
Top = 1920
Visible = 0 'False
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Left = 4680
TabIndex = 0
Text = "Text1"
Top = 1320
Width = 855
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "原 密 碼:"
Height = 180
Left = 3720
TabIndex = 5
Top = 1980
Visible = 0 'False
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H00FFFF80&
Caption = "用戶名稱:"
Height = 180
Left = 3720
TabIndex = 4
Top = 1380
Width = 900
End
End
Attribute VB_Name = "FormD5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
' ┃ Form65 修改密碼 ┃
' ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Option Explicit
' Public strUsd, strUsm, strUsk, strUsj As String ' 用戶名、密碼、級(jí)別及代碼
Dim bytLgn As Byte, bolTc As Boolean
Dim strUnk As String, strUsk As String, StrUsm As String, StrUsj As String, strUsd As String
'
Private Sub Form_Load()
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3
strT0 = "T_tm"
If myF_ExistT(strT0) < 1 Then ' 檢查表 A_tm 記錄
MsgBox " Not Find " & strT0 & " ... ", 48, " Error !"
bolTc = True
Exit Sub
End If
Set MyRs0 = New Recordset
StrSQL = "Select * From " & strT0 & " Where Left(Dm,2)='Kl' Order By Xh"
MyRs0.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
If MyRs0.RecordCount > 0 Then
MyRs0.MoveLast
Else
MsgBox " Not Find Datas In " & strT0 & " ... ", 48, " Error !!"
bolTc = True
Exit Sub
End If
End Sub
Private Sub Form_Activate()
If bolTc = True Then
Unload Me
End If
strUnk = ""
bytLgn = 3
Text2.Text = ""
Text1.Text = "": Text1.SetFocus
End Sub
Private Sub Text1_Change() ' 檢查用戶名
StrUsm = Trim(Text1.Text)
If myF_Len(StrUsm) > 6 Then
MsgBox " 用戶名最大長度為六個(gè)英文字符位,請(qǐng)修改 ... ", 48, " 請(qǐng)注意"
Text1.Text = Left(StrUsm, 6)
Text1.SetFocus ' 重新輸入
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) ' 用戶名
If KeyAscii = 13 Then
StrUsm = Trim(Text1.Text)
If StrUsm = "" Then
StrUsj = "3"
Command2.SetFocus ' Quit
Else
If P_HcUse(StrUsm) = True Then ' 用戶名通過
Call P_xxxx
Else ' 用戶名未通過
If bytLgn = 0 Then
MsgBox " 很抱歉,用戶名不符 ... ", 48, " 輸入錯(cuò)誤 !!!"
StrUsj = "3"
Unload Me
Exit Sub
End If
End If
End If
End If
End Sub
Function P_HcUse(Usn As String) As Boolean ' 核對(duì)用戶名
MyRs0.MoveFirst
If Usn = StrUsm Then
P_HcUse = True
Exit Function
End If
bytLgn = bytLgn - 1 ' 錯(cuò)
If bytLgn = 0 Then
P_HcUse = False ' 用戶名不符
Else
MsgBox " 請(qǐng)?jiān)佥斎胍淮斡脩裘?... ", 48, " 輸入錯(cuò)誤 " & IIf(bytLgn = 1, "!!", "!")
Text1 = ""
P_HcUse = False
End If
End Function
Private Sub P_xxxx() ' 按名取記錄集合
Set MyRs1 = New Recordset
StrSQL = "Select * From " & strT0 & " Where Left(Dm,2)='Kl' And Mc='" & StrUsm & "'"
MyRs1.Open StrSQL, cnnTce, adOpenKeyset, adLockOptimistic
If MyRs1.RecordCount < 1 Then
MsgBox " Not Find Datas On " & StrUsm & " ... ", 48, " Error !!!"
StrUsj = "3"
Unload Me
Exit Sub
End If
bytLgn = 3
Text1.Enabled = False
Text2.Visible = True: Label2.Visible = True
Text2.SetFocus
End Sub
Private Sub Text2_Change() ' 檢查密碼
strUsk = Trim(Text2.Text)
If strUsk = "" Then Exit Sub
If myF_Len(strUsk) > 6 Then
MsgBox " 密碼最大長度為六個(gè)英文字符位,請(qǐng)修改 ... ", 48, " 請(qǐng)注意"
Text2.Text = Left(strUsk, 6)
Text2.SetFocus ' 重新輸入
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer) ' txtPassword
If KeyAscii <> 13 Then Exit Sub
strUsk = Trim(Text2.Text)
If Label2.Caption Like "原*" Then
If strUsk = "" Then
Command2.SetFocus ' Quit
Else
If P_HcKls(strUsk) = True Then ' 密碼通過
Label2.Caption = "新 密 碼:"
Text2.Text = ""
Text2.SetFocus
Else ' 密碼未通過
If bytLgn = 0 Then
MsgBox " 很抱歉,密碼不符 ... ", 48, " 輸入錯(cuò)誤 !!!"
StrUsj = "3"
Unload Me
End If
End If
End If
Else ' 新密碼
If strUsk = "" Then
Command2.SetFocus ' Quit
Exit Sub
End If
If Label2.Caption Like "新*" Then
strUnk = strUsk
Label2.Caption = "再輸一次:"
Text2.Text = ""
Text2.SetFocus
Else
If strUnk = strUsk Then ' 通過
Command1.SetFocus
Else
MsgBox " 密碼修改失敗 ... ", 48, " Ok !"
Unload Me
End If
End If
End If
End Sub
Function P_HcKls(Usk As String) As Boolean ' 核對(duì)密碼
MyRs1.MoveFirst
Do While Not MyRs1.EOF
'MsgBox Usk & "-" & Trim(myRs0![Jc])
If Usk = Trim(MyRs1![Jc]) Then
strUsd = MyRs1![dm]
StrUsm = MyRs1![Mc]
' strUsj = Trim(myRs1![Bz])
P_HcKls = True
Exit Function
Exit Do
End If
MyRs1.MoveNext
Loop
bytLgn = bytLgn - 1 ' 無
If bytLgn = 0 Then
P_HcKls = False ' 密碼不符
Else
MsgBox " 請(qǐng)?jiān)佥斎胍淮蚊艽a ... ", 48, " 登錄錯(cuò)誤 " & IIf(bytLgn = 1, "!!", "!")
Text2 = ""
P_HcKls = False
End If
End Function
Private Sub Command1_KeyPress(KeyAscii As Integer) ' cmdOK
If KeyAscii = 13 Then Call Command1_Click
End Sub
Private Sub Command1_Click() ' 確認(rèn)處理
StrUsm = Trim(Text1.Text) ' 核對(duì)用戶名
If StrUsm = "" Then
Command2.SetFocus: Exit Sub ' Quit
End If
If P_HcUse(StrUsm) = False Then ' 未通過
If bytLgn = 0 Then
MsgBox " 很抱歉,用戶名不符 kk ... ", 48, " 登錄錯(cuò)誤 !!!"
StrUsj = "3"
Unload Me
Else
Text1.Text = ""
Text1.SetFocus ' 準(zhǔn)備重新輸入
End If
Exit Sub
End If
If Text2.Visible = False Then
Call P_xxxx ' 按名取記錄集
Exit Sub
End If
strUsk = Trim(Text2.Text) ' 核對(duì)密碼
If strUsk = "" Then
Command2.SetFocus: Exit Sub ' Quit
End If
If Label2.Caption Like "原" Then
If P_HcKls(strUsk) = False Then ' 未通過
If bytLgn = 0 Then
MsgBox " 很抱歉,密碼不符 ... ", 48, " 登錄錯(cuò)誤 !!!"
StrUsj = "3"
Unload Me
Else
Text2.Text = ""
Text2.SetFocus ' 重新輸入
End If
Exit Sub
Else ' 密碼通過
Label2.Caption = "新 密 碼:"
Text2.Text = ""
Text2.SetFocus
End If
Else ' 新密碼
If Label2.Caption Like "新" Then
strUnk = strUsk
Label2.Caption = "再輸一次:"
Else '
If strUnk = strUsk Then
MyRs1![Jc] = strUsk
MyRs1.Update
StrMsg = "完畢"
Else
StrMsg = "失敗"
End If
MsgBox " 密碼修改" & StrMsg & " ... ", 48, " Ok !"
Unload Me
End If
End If
End Sub
Private Sub Command2_Click() ' cmdCancel
StrUsj = "3"
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
MyRs0.Close: Set MyRs0 = Nothing
MyRs1.Close: Set MyRs1 = Nothing
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -