📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "LOGIN"
ClientHeight = 4530
ClientLeft = 1545
ClientTop = 1335
ClientWidth = 4425
BeginProperty Font
Name = "Arial"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4530
ScaleWidth = 4425
StartUpPosition = 2 'CenterScreen
Begin VB.FileListBox File1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1560
Left = 2040
TabIndex = 7
Top = 2880
Width = 2175
End
Begin VB.DirListBox Dir1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1530
Left = 240
TabIndex = 6
Top = 2880
Width = 1695
End
Begin VB.CommandButton cmdCancel
Caption = "Cancel"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 3
Top = 1920
Width = 1215
End
Begin VB.CommandButton cmdOk
Caption = "OK"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 720
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.TextBox txtpassword
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 1
Top = 1080
Width = 1695
End
Begin VB.TextBox txtcode
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 2160
TabIndex = 0
Top = 480
Width = 1695
End
Begin VB.Label lblpassword
Caption = "PassWord:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 5
Top = 1080
Width = 1095
End
Begin VB.Label lbluser
Caption = "UserCode:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 4
Top = 480
Width = 1095
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error GoTo err
Dim sCode As String, sPass As String
Dim rstClerk As Recordset
Dim rstent As Recordset
Dim rstcmp As Recordset
Dim sSQL As String
gsUserCode = ""
gsUserName = ""
gsEntCode = ""
gsEntDesc = ""
sCode = Trim(txtcode.Text)
sPass = Trim(txtpassword.Text)
If txtcode = "" Then
MsgBox "Please input your UserCode.", vbOKOnly, "Message"
Exit Sub
End If
sSQL = "select * from sysusr where usrcode='" & sCode & "' and passwrd='" & sPass & "'"
Set rstClerk = Acs_cnt.Execute(sSQL)
With rstClerk
Do While Not .EOF
gsUserCode = rstClerk!UsrCode
gsUserName = rstClerk!UrsName
gsRoleCode = rstClerk!rolcode
.MoveNext
Loop
End With
rstClerk.Close
If rstClerk Is Nothing Then Set rstClerk = Nothing
If gsUserCode = "" And gsUserName = "" Then
txtcode.SetFocus
MsgBox "User or PassWord is Error!", vbInformation, "Message"
Else
sSQL = "select entcode,entdesc from sysent"
Set rstent = Acs_cnt.Execute(sSQL)
gsEntCode = rstent!Entcode
gsEntDesc = rstent!entdesc
rstent.Close
If rstent Is Nothing Then Set rstent = Nothing
sSQL = "select cmpcode,cmpdesc from syscmp"
Set rstcmp = Acs_cnt.Execute(sSQL)
gsCmpCode = rstcmp!cmpcode
gsCmpDesc = rstcmp!cmpdesc
rstcmp.Close
If rstcmp Is Nothing Then Set rstcmp = Nothing
mdlMain.Show
Unload Me
End If
err:
If rstClerk Is Nothing Then Set rstClerk = Nothing
Exit Sub
End Sub
Private Sub Dir1_Change()
File1.path = Dir1.path
End Sub
Private Sub File1_DblClick()
On Error GoTo err
Dim acs_s As String
acs_s = File1.path & "\" & File1.FileName
If AcsS(acs_s) = True Then
frmLogin.Height = 3150
End If
Exit Sub
err:
MsgBox err.Description, vbOKOnly, "Error"
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
If MsgBox("Are you want to quit?", vbOKCancel, "Message") = vbOK Then
Call cmdCancel_Click
End If
End If
End Sub
Private Sub Form_Load()
Dim acs_s As String
Dim sPath As String
Dim fs As Object
' Set fs = CreateObject("Scripting.FileSystemObject")
If FindDirectory = False Then
acs_s = App.path & "\.." & "\dbs\lds.mdb"
frmLogin.Height = 3150
If AcsS(acs_s) = True Then
Else
Exit Sub
End If
Else
sPath = App.path & "\.." & "\Dbs"
Dir1.path = sPath
File1.path = Dir1.path
End If
End Sub
Private Function FindDirectory() As Boolean
Dim sPath As String, MyName
Dim fs As Object
FindDirectory = False
Set fs = CreateObject("Scripting.FileSystemObject")
sPath = App.path & "\..\" & "dbs\"
MyName = Dir(sPath, vbDirectory) ' 找寻第一项。
Do While MyName <> "" ' 开始循环。
' 跳过当前的目录及上层目录。
If MyName <> "." And MyName <> ".." Then
' 使用位比较来确定 MyName 代表一目录。
If (GetAttr(sPath & MyName) And vbDirectory) = vbDirectory Then
If fs.FileExists(sPath & MyName & "\lds.mdb") = True Then
FindDirectory = True
Exit Function
End If
End If
End If
MyName = Dir ' 查找下一个目录。
Loop
End Function
Private Sub txtCode_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
SendKeys "{tab}"
End If
End Sub
Private Sub txtpassword_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
Call cmdOK_Click
'SendKeys "{tab}"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -