- VERSION 5.00
- Begin VB.Form search
- BorderStyle = 1 'Fixed Single
- Caption = "员工信息查询"
- ClientHeight = 3510
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 7545
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MDIChild = -1 'True
- MinButton = 0 'False
- ScaleHeight = 3510
- ScaleWidth = 7545
- Begin VB.Frame FrmBorrow
- BorderStyle = 0 'None
- Height = 3255
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 7455
- Begin VB.CommandButton cmdSearch
- Caption = "查询"
- Height = 495
- Left = 5640
- TabIndex = 46
- Top = 120
- Width = 975
- End
- Begin VB.Frame frameAuthor
- BorderStyle = 0 'None
- Height = 495
- Left = 1080
- TabIndex = 40
- Top = 720
- Width = 6015
- Begin VB.CheckBox chkName
- Height = 255
- Left = 120
- TabIndex = 44
- Top = 120
- Width = 375
- End
- Begin VB.OptionButton optNameAnd
- Caption = "AND"
- Height = 255
- Left = 480
- TabIndex = 43
- Top = 120
- Width = 615
- End
- Begin VB.OptionButton optNameOr
- Caption = "OR"
- Height = 255
- Left = 1080
- TabIndex = 42
- Top = 120
- Width = 495
- End
- Begin VB.TextBox txtName
- Height = 270
- Left = 2760
- TabIndex = 41
- Top = 120
- Width = 2895
- End
- Begin VB.Label Label7
- Caption = "姓名:"
- Height = 255
- Left = 1680
- TabIndex = 45
- Top = 120
- Width = 735
- End
- End
- Begin VB.Frame framePHouse
- BorderStyle = 0 'None
- Caption = "n"
- Height = 375
- Left = 1080
- TabIndex = 34
- Top = 1440
- Width = 6015
- Begin VB.CheckBox chkBusi
- Height = 255
- Left = 120
- TabIndex = 38
- Top = 120
- Width = 375
- End
- Begin VB.OptionButton optBusiAnd
- Caption = "AND"
- Height = 255
- Left = 480
- TabIndex = 37
- Top = 120
- Width = 615
- End
- Begin VB.OptionButton optBusiOr
- Caption = "OR"
- Height = 255
- Left = 1080
- TabIndex = 36
- Top = 120
- Width = 495
- End
- Begin VB.TextBox txtBusi
- Height = 270
- Left = 2760
- TabIndex = 35
- Top = 120
- Width = 2895
- End
- Begin VB.Label Label6
- Caption = "职称:"
- Height = 255
- Left = 1680
- TabIndex = 39
- Top = 120
- Width = 855
- End
- End
- Begin VB.Frame frameContent
- BorderStyle = 0 'None
- Caption = "n"
- Height = 375
- Left = 1080
- TabIndex = 28
- Top = 1800
- Width = 6015
- Begin VB.CheckBox chkLevel
- Height = 255
- Left = 120
- TabIndex = 32
- Top = 120
- Width = 375
- End
- Begin VB.OptionButton optLevelAnd
- Caption = "AND"
- Height = 255
- Left = 480
- TabIndex = 31
- Top = 120
- Width = 615
- End
- Begin VB.OptionButton optLevelOr
- Caption = "OR"
- Height = 255
- Left = 1080
- TabIndex = 30
- Top = 120
- Width = 495
- End
- Begin VB.TextBox txtLevel
- Height = 270
- Left = 2760
- TabIndex = 29
- Top = 120
- Width = 2895
- End
- Begin VB.Label Label5
- Caption = "学历:"
- Height = 375
- Left = 1680
- TabIndex = 33
- Top = 120
- Width = 615
- End
- End
- Begin VB.Frame Frame3
- BorderStyle = 0 'None
- Height = 1095
- Left = 1080
- TabIndex = 9
- Top = 2160
- Width = 7695
- Begin VB.TextBox txtMonKeyFore
- Height = 270
- Left = 3720
- TabIndex = 24
- Top = 120
- Width = 375
- End
- Begin VB.CheckBox chkTimeKey
- Height = 255
- Left = 120
- TabIndex = 23
- Top = 120
- Width = 375
- End
- Begin VB.OptionButton optnTimeand
- Caption = "AND"
- Height = 255
- Left = 480
- TabIndex = 22
- Top = 120
- Width = 615
- End
- Begin VB.OptionButton optnTimeor
- Caption = "OR"
- Height = 255
- Left = 1080
- TabIndex = 21
- Top = 120
- Width = 495
- End
- Begin VB.TextBox txtYearKeyFore
- Height = 270
- Left = 2760
- TabIndex = 20
- Top = 120
- Width = 735
- End
- Begin VB.Frame Frame2
- BorderStyle = 0 'None
- Height = 375
- Left = 2760
- TabIndex = 16
- Top = 480
- Width = 3135
- Begin VB.OptionButton optnKeyFore
- Caption = "之前"
- Height = 255
- Left = 120
- TabIndex = 19
- Top = 120
- Width = 735
- End
- Begin VB.OptionButton optnKeyBack
- Caption = "之后"
- Height = 255
- Left = 840
- TabIndex = 18
- Top = 120
- Width = 735
- End
- Begin VB.OptionButton optnKeyBetween
- Caption = "之间"
- Height = 255
- Left = 1920
- TabIndex = 17
- Top = 120
- Width = 735
- End
- End
- Begin VB.Frame frmttime
- BorderStyle = 0 'None
- Height = 495
- Left = 4320
- TabIndex = 10
- Top = 0
- Visible = 0 'False
- Width = 2055
- Begin VB.TextBox txtYearKeyBack
- Height = 270
- Left = 240
- TabIndex = 12
- Top = 120
- Width = 735
- End
- Begin VB.TextBox txtMonKeyBack
- Height = 270
- Left = 1320
- TabIndex = 11
- Top = 120
- Width = 375
- End
- Begin VB.Label Label14
- Caption = "至"
- ForeColor = &H000000FF&
- Height = 255
- Left = 0
- TabIndex = 15
- Top = 240
- Width = 255
- End
- Begin VB.Label Label15
- Caption = "年"
- Height = 375
- Left = 1080
- TabIndex = 14
- Top = 240
- Width = 255
- End
- Begin VB.Label Label16
- Caption = "月"
- Height = 255
- Left = 1800
- TabIndex = 13
- Top = 240
- Width = 255
- End
- End
- Begin VB.Label Label9
- Caption = "月"
- Height = 255
- Left = 4080
- TabIndex = 27
- Top = 240
- Width = 255
- End
- Begin VB.Label Label8
- Caption = "年"
- Height = 255
- Left = 3480
- TabIndex = 26
- Top = 240
- Width = 255
- End
- Begin VB.Label Label3
- Caption = "进入时间:"
- Height = 255
- Left = 1680
- TabIndex = 25
- Top = 120
- Width = 1095
- End
- End
- Begin VB.Frame frameBookName
- BorderStyle = 0 'None
- Height = 495
- Left = 1080
- TabIndex = 3
- Top = 1080
- Width = 6015
- Begin VB.TextBox txtDept
- Height = 270
- Left = 2760
- TabIndex = 7
- Top = 120
- Width = 2895
- End
- Begin VB.OptionButton optDeptOr
- Caption = "OR"
- Height = 255
- Left = 1080
- TabIndex = 6
- Top = 120
- Width = 495
- End
- Begin VB.OptionButton optDeptAnd
- Caption = "AND"
- Height = 255
- Left = 480
- TabIndex = 5
- Top = 120
- Width = 615
- End
- Begin VB.CheckBox chkDept
- Height = 255
- Left = 120
- TabIndex = 4
- Top = 120
- Width = 375
- End
- Begin VB.Label Label2
- Caption = "部门:"
- Height = 255
- Left = 1680
- TabIndex = 8
- Top = 120
- Width = 615
- End
- End
- Begin VB.TextBox txtKey
- Height = 270
- Left = 2760
- TabIndex = 2
- Top = 240
- Width = 1575
- End
- Begin VB.ComboBox cmbItem
- Height = 300
- Left = 1200
- TabIndex = 1
- Top = 240
- Width = 1455
- End
- Begin VB.Label Label10
- Caption = "详细查询条件:"
- Height = 615
- Left = 240
- TabIndex = 48
- Top = 720
- Width = 855
- End
- Begin VB.Label Label1
- Caption = "查询条件:"
- Height = 255
- Left = 240
- TabIndex = 47
- Top = 240
- Width = 1215
- End
- End
- End
- Attribute VB_Name = "search"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmbitem_click()
- Select Case cmbItem.ListIndex
- Case 0
- '"无"
- txtKey.Visible = False
- chkName.Enabled = True
- chkDept.Enabled = True
- chkBusi.Enabled = True
- chkLevel.Enabled = True
- Case 1
- '"姓名"
- txtKey.Visible = True
- chkName.Enabled = False
- chkDept.Enabled = True
- chkBusi.Enabled = True
- chkLevel.Enabled = True
- Case 2
- '"部门"
- txtKey.Visible = True
- chkName.Enabled = True
- chkDept.Enabled = False
- chkBusi.Enabled = True
- chkLevel.Enabled = True
- Case 3
- '"职称"
- txtKey.Visible = True
- chkName.Enabled = True
- chkDept.Enabled = True
- chkBusi.Enabled = False
- chkLevel.Enabled = True
- Case 4
- '"学历"
- txtKey.Visible = True
- chkName.Enabled = True
- chkDept.Enabled = True
- chkBusi.Enabled = True
- chkLevel.Enabled = False
- End Select
- End Sub
- Private Sub cmdSearch_Click()
- Dim sqltxt As String
- Dim wheretxt As String
- '初始化Sqlstr和Wherestr
- sqltxt = "select * from ManInfo "
- wheretxt = ""
- '判断Combobox选项
- If cmbItem.ListIndex = 0 Then
- '无
- Else
- If txtKey.Text <> "" Then
- Select Case cmbItem.ListIndex
- Case 1
- '姓名
- wheretxt = wheretxt + "ygName='" & txtKey & "'"
- Case 2
- '部门
- wheretxt = wheretxt + "ygDept='" & txtKey & "'"
- Case 3
- '职称
- wheretxt = wheretxt + "ygBusi='" & txtKey & "'"
- Case 4
- '学历
- wheretxt = wheretxt + "ygLevel='" & txtKey & "'"
- End Select
- End If
- End If
- '详细条件
- '姓名关键字
- If chkName.Enabled And chkName.Value = 1 And txtName.Text <> "" Then
- If wherestr <> "" Then
- If optNameAnd.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- wheretxt = wheretxt + "ygName like '%" & txtName & "%'"
- End If
- '部门关键字
- If chkDept.Enabled And chkDept.Value = 1 And txtDept.Text <> "" Then
- If wheretxt <> "" Then
- If optDeptAnd.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- wheretxt = wheretxt + "ygDept like '%" & txtDept & "%'"
- End If
- '职称关键字
- If chkBusi.Enabled And chkBusi.Value = 1 And txtBusi.Text <> "" Then
- If wheretxt <> "" Then
- If optBusiAnd.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- wheretxt = wheretxt + "ygBusi like '%" & txtBusi & "%'"
- End If
- '学历关键字
- If chkLevel.Enabled And chkLevel.Value = 1 And txtLevel.Text <> "" Then
- If wheretxt <> "" Then
- If optLevelAnd.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- wheretxt = wheretxt + "ygLevel like '%" & txtLevel & "%'"
- End If
- '进入时间
- If chkTimeKey.Enabled And chkTimeKey.Value = 1 Then
- If optnKeyFore.Value Or optnKeyBack.Value Then
- If txtYearKeyFore.Text = "" Or txtMonKeyFore.Text = "" Then
- MsgBox "请完整填写查询时间!", vbOKOnly + vbInformation, "查询"
- Exit Sub
- End If
- If wheretxt <> "" Then
- If optnTimeand.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- '之前
- If optnKeyFore.Value Then
- wheretxt = wheretxt + "ygDate4<'" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'"
- '之后
- ElseIf optnKeyBack.Value Then
- wheretxt = wheretxt + "ygDate4>'" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'"
- End If
- ElseIf optnKeyBetween.Value Then
- If txtYearKeyFore.Text = "" Or txtMonKeyFore.Text = "" Or txtYearKeyBack.Text = "" Or txtMonKeyBack.Text = "" Then
- MsgBox "请完整填写查询时间", vbOKOnly + vbInformation, "查询"
- Exit Sub
- End If
- If wheretxt <> "" Then
- If optnTimeand.Value Then
- wheretxt = wheretxt + " and "
- Else
- wheretxt = wheretxt + " or "
- End If
- End If
- '之间
- wheretxt = wheretxt + "ygDate4 between '" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'and '" & txtYearKeyBack.Text + "-" + txtMonKeyBack.Text & "'"
- End If
- End If
- '综合所有条件
- If wheretxt <> "" Then
- wheretxt = "where " + wheretxt
- End If
- flagSearch = True
- sql = sqltxt + wheretxt
- frmManrecord1.ShowTitle
- frmManrecord1.ShowData
- frmManrecord1.Show
- frmManrecord1.ZOrder 0
- End Sub
- Private Sub Form_Load()
- cmbItem.AddItem "无"
- cmbItem.AddItem "姓名"
- cmbItem.AddItem "部门"
- cmbItem.AddItem "职称"
- cmbItem.AddItem "学历"
- cmbItem.ListIndex = 0
- End Sub
- Private Sub optnKeyBack_Click()
- frmttime.Visible = False
- End Sub
- Private Sub optnKeyBetween_Click()
- frmttime.Visible = True
- End Sub
- Private Sub optnKeyFore_Click()
- frmttime.Visible = False
- End Sub