📄 员工信息查询.frm
字号:
VERSION 5.00
Begin VB.Form Form12
Caption = "Form12"
ClientHeight = 1740
ClientLeft = 60
ClientTop = 420
ClientWidth = 3720
LinkTopic = "Form12"
ScaleHeight = 1740
ScaleWidth = 3720
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2160
TabIndex = 3
Top = 1200
Width = 855
End
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 375
Left = 1080
TabIndex = 2
Top = 1200
Width = 855
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 1
Top = 600
Width = 3015
End
Begin VB.Label Label1
Caption = "请输入你要查询员工的职工号:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 0
Top = 240
Width = 2775
End
End
Attribute VB_Name = "Form12"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rst As New ADODB.Recordset '定义Recordset对象
Dim strSql As String
Private Sub Command1_Click()
Dim i As Integer
If Text1.Text = "" Then
i = MsgBox("请输入要查询的员工的职工号!", vbInformation + vbOKCancel + vbApplicationModal, "提示")
If i = 1 Then
Unload Me
Form12.Show
Else
Unload Me
Form5.Show
End If
Else
If rst.State = adStateOpen Then
rst.Close
End If
If IsNumeric(Text1.Text) = False Then
MsgBox "职工号必须是数值!请重新输入!", vbInformation + vbOKOnly + vbApplicationModal, "提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
strSql = "select ygxx.职工号,ygxx.姓名,ygxx.性别,ygxx.年龄,ygxx.籍贯,ygxx.学历,ygxx.职称,ygxx.家庭地址,ygxx.联系电话 from ygxx where ygxx.职工号='" & Trim(Text1.Text) & "'"
rst.Open strSql, cnn, 1, 1
If rst.State = 1 Then
rst.Close
End If
rst.Open "select * from ygxx where 职工号='" & Text1.Text & "'", cnn, 1, 1
Set Form5.DataGrid1.DataSource = rst
On Error GoTo err1
Call fillrsinfo3
Unload Me
Form4.Show
err1:
If Err.Number = 6160 Then
MsgBox "没有这个员工,请重新输入!", vbInformation + vbOKOnly + vbApplicationModal, "提示"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Else
Exit Sub
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form5.Show
End Sub
Public Sub fillrsinfo3()
Form4.Text1.Text = Trim(Form5.DataGrid1.Columns("职工号"))
Form4.Text2.Text = Trim(Form5.DataGrid1.Columns("姓名"))
Form4.Text3.Text = Trim(Form5.DataGrid1.Columns("性别"))
Form4.Text4.Text = Trim(Form5.DataGrid1.Columns("年龄"))
Form4.Text5.Text = Trim(Form5.DataGrid1.Columns("籍贯"))
Form4.Text6.Text = Trim(Form5.DataGrid1.Columns("学历"))
Form4.Text7.Text = Trim(Form5.DataGrid1.Columns("职称"))
Form4.Text8.Text = Trim(Form5.DataGrid1.Columns("家庭地址"))
Form4.Text9.Text = Trim(Form5.DataGrid1.Columns("联系电话"))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -