📄 frm_login.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Login
BackColor = &H00FF80FF&
Caption = "系统登录"
ClientHeight = 2355
ClientLeft = 60
ClientTop = 345
ClientWidth = 4125
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 2355
ScaleWidth = 4125
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BackColor = &H00FF80FF&
Height = 1575
Left = 120
TabIndex = 4
Top = 120
Width = 3855
Begin VB.TextBox txtUser
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 0
Top = 240
Width = 2055
End
Begin VB.TextBox txtPwd
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 1
Top = 840
Width = 2055
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 6
Top = 360
Width = 840
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 5
Top = 960
Width = 630
End
End
Begin VB.CommandButton CmdExit
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2520
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.CommandButton CmdOk
Caption = "登录"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 2
Top = 1800
Width = 975
End
End
Attribute VB_Name = "Frm_Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim n As Integer
Private Sub CmdExit_Click()
End
End Sub
Private Sub CmdOk_Click()
n = n + 1
Set rpwd = New Recordset
rpwd.Open "select * from 用户表 where [user]='" & txtUser.Text & "' and pwd ='" & txtPwd & "'", cs, adOpenKeyset, adLockPessimistic
If rpwd.RecordCount = 0 Then
GoTo ll
Else
Unload Me
If rpwd.Fields("power") = "超级管理员" Then
MDIForm1.StatusBar1.Panels(1).Text = "当前用户:" & rpwd.Fields("user")
MDIForm1.StatusBar1.Panels(2).Text = "描述:超级管理员"
MDIForm1.A.Enabled = True
MDIForm1.B.Enabled = True
MDIForm1.C.Enabled = True
MDIForm1.D.Enabled = True
MDIForm1.E.Enabled = True
MDIForm1.F.Enabled = True
MDIForm1.H.Enabled = True
ElseIf rpwd.Fields("power") = "出库管理员" Then
MDIForm1.StatusBar1.Panels(1).Text = "当前用户:" & rpwd.Fields("user")
MDIForm1.StatusBar1.Panels(2).Text = "描述:出库管理员"
MDIForm1.A1.Enabled = False
MDIForm1.B.Enabled = False
MDIForm1.C.Enabled = True
MDIForm1.D.Enabled = False
MDIForm1.E.Enabled = True
MDIForm1.F.Enabled = True
MDIForm1.H.Enabled = True
ElseIf rpwd.Fields("power") = "库存管理员" Then
MDIForm1.StatusBar1.Panels(1).Text = "当前用户:" & rpwd.Fields("user")
MDIForm1.StatusBar1.Panels(2).Text = "描述:库存管理员"
MDIForm1.A.Enabled = False
MDIForm1.B.Enabled = False
MDIForm1.C.Enabled = False
MDIForm1.D.Enabled = True
MDIForm1.E.Enabled = True
MDIForm1.F.Enabled = True
MDIForm1.H.Enabled = True
ElseIf rpwd.Fields("power") = "入库管理员" Then
MDIForm1.StatusBar1.Panels(1).Text = "当前用户:" & rpwd.Fields("user")
MDIForm1.StatusBar1.Panels(2).Text = "描述:入库管理员"
MDIForm1.A.Enabled = False
MDIForm1.B.Enabled = True
MDIForm1.C.Enabled = False
MDIForm1.D.Enabled = False
MDIForm1.E.Enabled = False
MDIForm1.F.Enabled = True
MDIForm1.H.Enabled = True
End If
End If
Exit Sub
ll:
MsgBox "密码错误,请重新输入!", 16, "操作提示"
txtPwd.SetFocus
txtPwd.SelStart = 0
txtPwd.SelLength = Len(txtPwd.Text)
If n >= 3 Then
MsgBox "对不起,您无权访问本系统!", 48, "操作提示"
End
End If
End Sub
Private Sub Form_Load()
Call LoginAccess
End Sub
Private Sub txtPwd_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then CmdOk_Click
End Sub
Private Sub txtUser_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then txtPwd.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -