📄 frm_teacher.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Frm_teacher
BorderStyle = 3 'Fixed Dialog
Caption = "查询教师信息"
ClientHeight = 5640
ClientLeft = 45
ClientTop = 435
ClientWidth = 10305
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5640
ScaleWidth = 10305
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "退出查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5280
TabIndex = 4
Top = 5160
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "查询"
Default = -1 'True
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 3
Top = 5160
Width = 1455
End
Begin VB.Frame Frame1
Caption = "查询方式"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 240
TabIndex = 6
Top = 3960
Width = 9855
Begin VB.ComboBox Combo_Biandong
Height = 300
Left = 7920
Style = 2 'Dropdown List
TabIndex = 2
Top = 405
Width = 1215
End
Begin VB.TextBox Text_name
Height = 300
Left = 4440
TabIndex = 1
Text = "Text2"
Top = 400
Width = 1215
End
Begin VB.TextBox Text_Id
Height = 300
Left = 1800
TabIndex = 0
Text = "Text1"
Top = 400
Width = 1215
End
Begin VB.CheckBox Check3
Caption = "按变动情况"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 6240
TabIndex = 9
Top = 240
Width = 1500
End
Begin VB.CheckBox Check2
Caption = "按姓名"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 8
Top = 240
Width = 990
End
Begin VB.CheckBox Check1
Caption = "按编号"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 7
Top = 240
Width = 990
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3735
Left = 0
TabIndex = 5
Top = 0
Width = 10305
_ExtentX = 18177
_ExtentY = 6588
_Version = 393216
Cols = 21
AllowUserResizing= 3
GridLineWidth = 2
End
End
Attribute VB_Name = "Frm_teacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
If Check1.Value Then
Text_Id.Enabled = True
Text_Id.SetFocus
Check3.Enabled = False
ElseIf Check2.Value = False Then
Check3.Enabled = True
End If
End Sub
Private Sub Check2_Click()
If Check2.Value Then
Text_name.Enabled = True
Text_name.SetFocus
Check3.Enabled = False
ElseIf Check1.Value = False Then
Check3.Enabled = True
End If
End Sub
Private Sub Check3_Click()
If Check3.Value Then
Check1.Enabled = False
Check2.Enabled = False
Combo_Biandong.Enabled = True
Text_Id.Enabled = False
Text_name.Enabled = False
Else
Check1.Enabled = True
Check2.Enabled = True
Text_Id.Enabled = True
Text_name.Enabled = True
Combo_Biandong.Enabled = False
End If
End Sub
Private Sub Command1_Click()
Dim TxtSql As String
Dim dd As Boolean
Dim db As Database
Dim rst As Recordset
TxtSql = "select * from teacher_basic_info where "
If Check1.Value Then
If Trim(Text_Id.Text) = "" Then
MsgBox "请输入要查询的教师编号!", vbOKOnly + vbExclamation, "警告"
Text_Id.SetFocus
Exit Sub
Else
If Not IsNumeric(Trim(Text_Id.Text)) Then
MsgBox "请输入数字型教师编号!", vbOKOnly + vbExclamation, "警告"
Text_Id.SetFocus
Exit Sub
End If
dd = True
TxtSql = TxtSql & " 编号='" & Trim(Text_Id.Text) & "'"
End If
End If
If Check2.Value Then
If Trim(Text_name.Text) = "" Then
MsgBox "请输入要查询的教师姓名!", vbOKOnly + vbExclamation, "警告"
Text_name.SetFocus
Exit Sub
Else
If dd Then
TxtSql = TxtSql & " and 姓名='" & Trim(Text_name.Text) & "'"
Else
TxtSql = TxtSql & " 姓名='" & Trim(Text_name.Text) & "'"
End If
End If
End If
If Check3.Value Then
If Combo_Biandong.Listindex = -1 Then
MsgBox "请选择教师变动情况!", vbOKOnly + vbExclamation, "警告"
Combo_Biandong.SetFocus
Exit Sub
Else
TxtSql = TxtSql & " 变动情况='" & Trim(Combo_Biandong.Text) & "'"
End If
End If
If Check1.Value = False And Check2.Value = False And Check3.Value = False Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
TxtSql = TxtSql & " order by 编号"
Set db = OpenDatabase(App.Path + "\db\teaching_manage.mdb", ReadOnly)
Set rst = db.OpenRecordset(TxtSql)
With MSFlexGrid1
.Rows = 2
.CellAlignment = 4
.TextMatrix(0, 1) = "编号"
.TextMatrix(0, 2) = "姓名"
.TextMatrix(0, 3) = "性别"
.TextMatrix(0, 4) = "出生年月"
.TextMatrix(0, 5) = "民族"
.TextMatrix(0, 6) = "身份证号"
.TextMatrix(0, 7) = "健康状况"
.TextMatrix(0, 8) = "籍贯"
.TextMatrix(0, 9) = "毕业院校"
.TextMatrix(0, 10) = "所学专业"
.TextMatrix(0, 11) = "毕业时间"
.TextMatrix(0, 12) = "学历"
.TextMatrix(0, 13) = "职称"
.TextMatrix(0, 14) = "聘用时间"
.TextMatrix(0, 15) = "政治面貌"
.TextMatrix(0, 16) = "加入时间"
.TextMatrix(0, 17) = "工资级别"
.TextMatrix(0, 18) = "基本工资"
.TextMatrix(0, 19) = "变动情况"
.TextMatrix(0, 20) = "奖惩情况"
Do While Not rst.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 2, 1) = rst.Fields(0)
.TextMatrix(.Rows - 2, 2) = rst.Fields(1)
.TextMatrix(.Rows - 2, 3) = rst.Fields(2)
.TextMatrix(.Rows - 2, 4) = Format(rst.Fields(3), "yyyy-mm-dd")
.TextMatrix(.Rows - 2, 5) = rst.Fields(4)
.TextMatrix(.Rows - 2, 6) = rst.Fields(5)
.TextMatrix(.Rows - 2, 7) = rst.Fields(6)
.TextMatrix(.Rows - 2, 8) = rst.Fields(7)
.TextMatrix(.Rows - 2, 9) = rst.Fields(8)
.TextMatrix(.Rows - 2, 10) = rst.Fields(9)
.TextMatrix(.Rows - 2, 11) = Format(rst.Fields(10), "yyyy-mm-dd")
.TextMatrix(.Rows - 2, 12) = rst.Fields(11)
.TextMatrix(.Rows - 2, 13) = rst.Fields(12)
.TextMatrix(.Rows - 2, 14) = Format(rst.Fields(13), "yyyy-mm-dd")
.TextMatrix(.Rows - 2, 15) = rst.Fields(14)
If rst.Fields(15) <> "" Then
.TextMatrix(.Rows - 1, 16) = Format(rst.Fields(15), "yyyy-mm-dd")
Else
.TextMatrix(.Rows - 1, 16) = ""
End If
.TextMatrix(.Rows - 1, 17) = rst.Fields(16)
.TextMatrix(.Rows - 1, 18) = rst.Fields(17)
If rst.Fields(18) <> "" Then
.TextMatrix(.Rows - 1, 19) = rst.Fields(18)
Else
.TextMatrix(.Rows - 1, 19) = ""
End If
If rst.Fields(19) <> "" Then
.TextMatrix(.Rows - 1, 20) = rst.Fields(19)
Else
.TextMatrix(.Rows - 1, 20) = ""
End If
rst.MoveNext
Loop
If .Rows = 2 Then
MsgBox "没有要查找的信息!", vbOKOnly + vbExclamation, "警告"
End If
End With
rst.Close
db.Close
Text_Id.Text = ""
Text_name.Text = ""
Combo_Biandong.Listindex = -1
Check1.Value = False
Check2.Value = False
Check3.Value = False
Combo_Biandong.Enabled = False
Text_Id.Enabled = False
Text_name.Enabled = False
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text_Id.Text = ""
Text_name.Text = ""
Combo_Biandong.AddItem "调离"
Combo_Biandong.AddItem "退休"
Combo_Biandong.AddItem "离职"
Combo_Biandong.AddItem "下岗"
Combo_Biandong.AddItem "分流"
Combo_Biandong.AddItem "死亡"
Combo_Biandong.Listindex = -1
Combo_Biandong.Enabled = False
Text_Id.Enabled = False
Text_name.Enabled = False
End Sub
Private Sub Text_Id_Change()
If Len(Text_Id.Text) > 8 Then
Text_Id.Text = Left(Text_Id.Text, 8)
MsgBox "编号只能是8位数字字符串!", vbOKOnly + vbExclamation, "警告"
Text_Id.SelStart = 9
Text_Id.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -