frmlogin_set.frm
来自「本系统可用于医院和专业体检中心的健康体检管理」· FRM 代码 · 共 237 行
FRM
237 行
VERSION 5.00
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form frmLogin_Set
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 4245
ClientLeft = 2835
ClientTop = 3480
ClientWidth = 7395
Icon = "frmLogin_Set.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin_Set.frx":0CCA
ScaleHeight = 2508.086
ScaleMode = 0 'User
ScaleWidth = 6943.504
StartUpPosition = 2 'CenterScreen
Begin VB.ComboBox cmbJobNumber
Height = 315
Left = 3510
TabIndex = 0
Top = 2430
Width = 2175
End
Begin XPControls.XPCommandButton cmdCancel
Cancel = -1 'True
Height = 390
Left = 4740
TabIndex = 3
Top = 3540
Width = 930
_ExtentX = 1640
_ExtentY = 688
Caption = "退出(&E)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin XPControls.XPCommandButton cmdOK
Height = 390
Left = 3540
TabIndex = 2
Top = 3540
Width = 930
_ExtentX = 1640
_ExtentY = 688
Caption = "登录(&L)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
IMEMode = 3 'DISABLE
Left = 3510
PasswordChar = "*"
TabIndex = 1
Top = 2955
Width = 2151
End
Begin VB.Label lblName
BackStyle = 0 'Transparent
Height = 255
Left = 5790
TabIndex = 4
Top = 2460
Width = 1065
End
End
Attribute VB_Name = "frmLogin_Set"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Public clsauthority
Private Sub cmbJobNumber_Change()
lblName.Caption = GetManagerName(cmbJobNumber.Text)
End Sub
Private Sub cmbJobNumber_Click()
lblName.Caption = GetManagerName(cmbJobNumber.Text)
End Sub
Private Sub cmdCancel_Click()
'set the global var to false
'to denote a failed login
LoginSucceeded = False
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error GoTo ErrMsg
Dim strSQL As String
Dim rsTemp As ADODB.Recordset
' Me.MousePointer = vbArrowHourglass
'用户验证
strSQL = "select EmployeeID from RY_Employee" _
& " where JobNumber='" & cmbJobNumber.Text & "'" _
& " and Password='" & txtPassword.Text & "'" _
& " and Enabled=1"
Set rsTemp = New ADODB.Recordset
rsTemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
If rsTemp.EOF Then
MsgBox "工号或者密码不正确!请重新输入。工号和密码的字母必须使用正确的大小写。" _
& "请确定是否因疏忽而按下了键盘左侧的Caps Lock。", vbExclamation, "警告"
txtPassword.SetFocus
GoTo ExitLab
End If
'记录用户名
gintManagerID = rsTemp("EmployeeID")
Call g_clsAuthority.SetAuthority(gintManagerID)
rsTemp.Close
Set rsTemp = Nothing
'加载主窗体
MDIForm1.Show
'卸载登录窗体
Unload Me
GoTo ExitLab
ErrMsg:
Me.MousePointer = vbDefault
MsgBoxW Err
ExitLab:
'
End Sub
Private Sub Form_Activate()
cmbJobNumber.SetFocus
End Sub
Private Sub Form_Load()
On Error GoTo ErrMsg
Dim strSQL As String
Dim rsTemp As ADODB.Recordset
Screen.MousePointer = vbArrowHourglass
'加载所有启用的用户
strSQL = "select EmployeeID,JobNumber from RY_Employee" _
& " where Enabled=1" _
& " order by Name"
Set rsTemp = New ADODB.Recordset
rsTemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
If Not rsTemp.EOF Then
With cmbJobNumber
Do
.AddItem rsTemp("JobNumber")
.ItemData(.NewIndex) = rsTemp("EmployeeID")
rsTemp.MoveNext
Loop While Not rsTemp.EOF
' .ListIndex = 0
End With
rsTemp.Close
End If
GoTo ExitLab
ErrMsg:
MsgBoxW Err, vbExclamation
ExitLab:
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmLogin_Set = Nothing
End Sub
Private Sub txtPassword_GotFocus()
Call SelectContents(txtPassword)
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
cmdOK_Click
KeyAscii = 0
End If
End Sub
'查找指定工号的用户名
Private Function GetManagerName(ByVal strJobNumber As String)
On Error GoTo ErrMsg
Dim strSQL As String
Dim rsTemp As ADODB.Recordset
Me.MousePointer = vbArrow
'获取当前用户的名称
strSQL = "select Name from RY_Employee" _
& " where JobNumber='" & Trim(cmbJobNumber.Text) & "'"
Set rsTemp = New ADODB.Recordset
rsTemp.Open strSQL, GCon, adOpenForwardOnly, adLockReadOnly
If Not rsTemp.EOF Then
GetManagerName = rsTemp("Name")
rsTemp.Close
End If
Set rsTemp = Nothing
GoTo ExitLab
ErrMsg:
MsgBoxW Err
ExitLab:
Me.MousePointer = vbDefault
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?