📄 main_dialog_ygxx.frm
字号:
VERSION 5.00
Begin VB.Form main_dialog_ygxx
BorderStyle = 1 'Fixed Single
Caption = "员工信息窗口"
ClientHeight = 1335
ClientLeft = 45
ClientTop = 225
ClientWidth = 3825
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1335
ScaleWidth = 3825
StartUpPosition = 1 '所有者中心
Begin VB.ComboBox Combo1
Height = 300
Left = 240
TabIndex = 3
Text = "Combo1"
Top = 435
Width = 3225
End
Begin VB.CommandButton Command2
Caption = "退出(&E)"
Height = 330
Left = 1935
TabIndex = 2
Top = 900
Width = 1245
End
Begin VB.CommandButton Command1
Caption = "确定(&U)"
Height = 330
Left = 510
TabIndex = 1
Top = 900
Width = 1245
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请选择或输入员工编号、姓名"
ForeColor = &H00000000&
Height = 270
Left = 210
TabIndex = 0
Top = 120
Width = 2550
End
End
Attribute VB_Name = "main_dialog_ygxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Private Sub Form_Activate()
'打开"员工信息表"
rs1.Open "select 员工编号,员工姓名 from 员工信息表 order by 员工编号", cnn, adOpenKeyset, adLockOptimistic
If rs1.BOF = False Then rs1.MoveFirst
For i = 0 To rs1.RecordCount - 1
'在combo1中添加员工编号、员工姓名
Combo1.AddItem (Trim(rs1.Fields("员工编号")) & " " & Trim(rs1.Fields("员工姓名")))
rs1.MoveNext
Next i
If Combo1.ListCount > 0 Then Combo1.ListIndex = 0
'关闭表
rs1.Close
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
'VbKeyReturn常数为键盘上的"回车键"
If KeyCode = vbKeyReturn Then Command1.SetFocus '回车command1获得焦点
End Sub
Private Sub Command1_Click()
main_qtgl_ktgl_ktfw.Label4(0).Caption = main_qtgl_ktgl.Label4(0)
rs2.Open "select * from 员工信息表 where 员工信息表.员工编号='" + Left(Combo1.text, 5) + "'or 员工信息表.员工姓名='" + Combo1.text + "'", cnn, adOpenKeyset, adLockOptimistic
If rs2.RecordCount > 0 Then
Load main_qtgl_ktgl_ktfw
main_qtgl_ktgl_ktfw.Show
main_qtgl_ktgl_ktfw.Labbh.Caption = Trim(rs2.Fields("员工编号"))
main_qtgl_ktgl_ktfw.Labxm.Caption = Trim(rs2.Fields("员工姓名"))
Unload Me
Else
MsgBox ("查无此员工!")
End If
rs2.Close
End Sub
Private Sub Command2_Click()
main_qtgl_ktgl.Enabled = True
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
main_qtgl_ktgl.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -