我的登录系统是:
Private Sub Command1_Click()
ComIn
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Activate()
Dim s As String
s = App.Path & "\evaluation.mdb"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source =" + Chr(34) + s + Chr(34) & ";Persist Security Info=False" '打开数据库
= adCmdTable
Adodc1.RecordSource = "登录表"
Adodc1.Refresh
Text1.SetFocus
End Sub
Private Sub Form_Load()
Label1.Caption = "欢迎使用土地评估登记系统!"
Frm_in.Width = 6500
Frm_in.Height = 4500
Frm_in.Top = (Screen.Height - Frm_in.Height) / 4
Frm_in.Left = (Screen.Width - Frm_in.Width) / 2
Text1.Text = ""
Label3.Caption = "作者:陈** 电话 137**"
Label3.Enabled = False
Text2.Visible = False
Adodc1.Visible = False
Text1.PasswordChar = "*"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then ComIn
End Sub
Public Sub ComIn()
User_Entry = Text2.Text
Dim i As Integer
Static n As Integer
'静态变量用于统计登录次数
If Text1.Text = User_Entry Then
Unload Frm_in
'关闭系统登录
MDIForm1.task.Enabled = True
MDIForm1.gathering.Enabled = True
MDIForm1.query.Enabled = True
MDIForm1.production.Enabled = True
MDIForm1.Delete.Enabled = False
MDIForm1.Join.Enabled = False
MDIForm1.eData.Enabled = True
task_num = 1
gathering_num = 1
query_num = 1
production_num = 1
delete_num = 0
join_num = 0
edata_num = 1
ElseIf Text1.Text = User_Entry + 1 Then
Unload Frm_in
'关闭系统登录
MDIForm1.task.Enabled = True
MDIForm1.gathering.Enabled = True
MDIForm1.query.Enabled = True
MDIForm1.production.Enabled = True
MDIForm1.Delete.Enabled = True
MDIForm1.Join.Enabled = True
MDIForm1.eData.Enabled = True
task_num = 1
gathering_num = 1
query_num = 1
production_num = 1
delete_num = 1
join_num = 1
edata_num = 1
Else
n = n + 1
If n < 3 Then
i = MsgBox("登录密码错误,请重新输入!", vbCritical + vbRetryCancel + vbDefaultButton1, "登录失败")
If i = vbRetry Then
Text1.Text = ""
Text1.SetFocus
Else
End
End If
Else
End
End If
End If
End Sub