📄 logondlg.frm
字号:
VERSION 5.00
Begin VB.Form LogonDlg
BorderStyle = 3 'Fixed Dialog
Caption = "系统注册"
ClientHeight = 3120
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4830
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3120
ScaleWidth = 4830
ShowInTaskbar = 0 'False
Begin VB.TextBox PassWord
Height = 270
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 7
Top = 1680
Width = 1575
End
Begin VB.ComboBox ComboUser
Height = 300
Left = 2160
Style = 2 'Dropdown List
TabIndex = 5
Top = 1080
Width = 1575
End
Begin VB.ComboBox ComboYear
Height = 300
Left = 2160
Style = 2 'Dropdown List
TabIndex = 2
Top = 480
Width = 1575
End
Begin VB.CommandButton CancelButton
Caption = "取消"
Height = 375
Left = 2640
TabIndex = 1
Top = 2280
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "确定"
Height = 375
Left = 960
TabIndex = 0
Top = 2280
Width = 1215
End
Begin VB.Label LabelPassWord
Caption = "密码"
Height = 255
Left = 1080
TabIndex = 6
Top = 1680
Width = 615
End
Begin VB.Label LabelUser
Caption = "用户"
Height = 255
Left = 1080
TabIndex = 4
Top = 1080
Width = 495
End
Begin VB.Label LabelYear
Caption = "年度"
Height = 255
Left = 1080
TabIndex = 3
Top = 480
Width = 495
End
Begin VB.Image Image
Height = 480
Left = 240
Picture = "LogonDlg.frx":0000
Top = 360
Width = 480
End
End
Attribute VB_Name = "LogonDlg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_ReturnCode As ReturnCode
Private m_Conn As ADODB.Connection
Private m_User As ADODB.Recordset
Private m_DataName As String
Private m_UserName As String
Public Function DoModal() As ReturnCode
m_ReturnCode = RC_CANCET
Me.Show vbModal
DoModal = m_ReturnCode
End Function
Private Sub CancelButton_Click()
m_ReturnCode = RC_CANCET
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Long
Dim re As ADODB.Recordset
Dim t_Date As String
Set m_Conn = New ADODB.Connection
With m_Conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.CommandTimeout = 7
.ConnectionTimeout = 10
.Open App.Path & "\CMSystem.mdb"
End With
Set re = New ADODB.Recordset
re.CursorLocation = adUseServer
re.Open "SELECT * FROM DataYear", m_Conn, adOpenForwardOnly, adLockReadOnly
While Not re.EOF
ComboYear.AddItem re.Fields(1).Value
re.MoveNext
Wend
Set m_User = New ADODB.Recordset
m_User.CursorLocation = adUseClient
m_User.Open "SELECT * FROM CM_User", m_Conn, adOpenDynamic, adLockReadOnly
While Not m_User.EOF
ComboUser.AddItem m_User.Fields(1).Value
m_User.MoveNext
Wend
t_Date = Format$(Date, "yyyy")
For i = 0 To ComboYear.ListCount - 1
If ComboYear.List(i) = t_Date Then
ComboYear.ListIndex = i
Exit For
End If
Next i
Set re = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_User = Nothing
End Sub
Private Sub OKButton_Click()
If Trim$(ComboYear.Text) = "" Then
MsgBox "请选择年度", vbCritical Or vbOKOnly, "错误"
ComboYear.SetFocus
Exit Sub
End If
If Trim$(ComboUser.Text) = "" Then
MsgBox "请选择操作员", vbCritical Or vbOKOnly, "错误"
ComboUser.SetFocus
Exit Sub
End If
m_User.MoveFirst
m_User.Find "Name='" & ComboUser.Text & "'"
If PassWord.Text <> m_User.Fields(2).Value Then
MsgBox "密码不正确,请重新输入", vbCritical Or vbOKOnly, "错误"
PassWord.SetFocus
Exit Sub
End If
m_DataName = "Data" & Trim$(ComboYear.Text) & ".mdb"
m_UserName = Trim$(ComboUser.Text)
m_ReturnCode = RC_OK
Unload Me
End Sub
Public Property Get DataName() As String
DataName = m_DataName
End Property
Public Property Get UserName() As String
UserName = m_UserName
End Property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -