Option Explicit
Private Sub Form_Load()
Dim Mpath As String
Mpath = VB.App.Path
If Right(Mpath, 1) <> "/" Then Mpath = Mpath + "/"
Data1.DatabaseName = Mpath + "管理系统数据库.mdb"
Data1.RecordSource = "select 帐号,密码 from 管理员"
Data1.Refresh
Text7.DataField = "帐号"
Text8.DataField = "密码"
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If X > Shape1.Left And X < Shape1.Left + Shape1.Width And Y > Shape1.Top And Y < Shape1.Top + Shape1.Height Then
Shape1.Visible = True
Label7.ForeColor = &HFF&
Else:
Shape1.Visible = False
Label7.ForeColor = &H0&
End If
If X > Shape2.Left And X < Shape2.Left + Shape2.Width And Y > Shape2.Top And Y < Shape2.Top + Shape2.Height Then
Shape2.Visible = True
Label8.ForeColor = &HFF&
Else:
Shape2.Visible = False
Label8.ForeColor = &H0&
End If
If X > Shape3.Left And X < Shape3.Left + Shape3.Width And Y > Shape3.Top And Y < Shape3.Top + Shape3.Height Then
Shape3.Visible = True
Label9.ForeColor = &HFF&
Else:
Shape3.Visible = False
Label9.ForeColor = &H0&
End If
If X > Shape5.Left And X < Shape5.Left + Shape5.Width And Y > Shape5.Top And Y < Shape5.Top + Shape5.Height Then
Shape5.Visible = True
Label10.ForeColor = &HFF&
Else:
Shape5.Visible = False
Label10.ForeColor = &H0&
End If
End Sub
Private Sub Label10_Click()
Unload Me
main.Show
End Sub
Private Sub Label9_Click()
Unload Me
P = True
a3.Show
End Sub
Private Sub Label7_Click() '进行口令的修改
Label7.Enabled = Not Label7.Enabled
Label8.Enabled = Not Label8.Enabled
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text1.SetFocus
End Sub
Private Sub Label8_Click()
Dim z As String
Text1.SetFocus
If Text1.Text = Text7.Text And Text2.Text = Text8.Text And Text3.Text = Text5.Text And Text4.Text = Text6.Text Then
'And Text4.Text <> "" And Text5.Text <> "" And Text6.Text <> "" And Text7.Text <> "" Then
'以上一句是防止新密码与新帐号一样的语句,若起用,就可避免一致,这样加大了系统的安全性!!
MsgBox "口令修改成功!!", 48
Data1.Recordset.Edit
Text7.Text = Text5.Text
Text8.Text = Text6.Text
Data1.Recordset.Update
Label7.Enabled = Not Label7.Enabled
Label8.Enabled = Not Label8.Enabled
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
ElseIf Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" Then '输入空口令
z = MsgBox("您输入的新口令是空的,这是不合法的口令!!要重新输入吗?", 5)
If z = 4 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
ElseIf z = 2 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Label8.Enabled = Not Label8.Enabled
Label7.Enabled = Not Label7.Enabled
End If
ElseIf Text1.Text <> Text7.Text Or Text2.Text <> Text8.Text Then
z = MsgBox("您输入的原始口令有误!!要重新输入吗?", 5)
If z = 4 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
ElseIf z = 2 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Label8.Enabled = Not Label8.Enabled
Label7.Enabled = Not Label7.Enabled
End If
ElseIf Text3.Text <> Text5.Text Or Text4.Text <> Text6.Text Then '两次输入的口令不一致
z = MsgBox("两次输入的口令不一致!要重新输入吗?", 5)
If z = 4 Then
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text3.SetFocus
ElseIf z = 2 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Label8.Enabled = Not Label8.Enabled
Label7.Enabled = Not Label7.Enabled
Exit Sub
End If
End If
End Sub