📄 frmempquery.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 1
Top = 600
Width = 1050
End
End
Begin VB.Line Line1
BorderColor = &H00FAF5BE&
BorderStyle = 3 'Dot
BorderWidth = 2
X1 = 0
X2 = 4800
Y1 = 2520
Y2 = 2520
End
End
Attribute VB_Name = "frmEmpQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
'Download by http://www.codefans.net
Attribute VB_Exposed = False
Option Explicit
Private FieldName As String '要查询的字段名
Private FieldValue As Variant '要查询的值
Private Operater As String '操作符
Private strFilter As String '查询字符串
Private Sub cmbDateItem_Click()
Select Case cmbDateItem.ListIndex
Case 0
FieldName = "Emp_birthday"
Case 1
FieldName = "Emp_Attend_time"
Case 2
FieldName = "Emp_Join_time"
End Select
End Sub
Private Sub cmbQueryItem_Click()
With cmbQueryItem
Select Case .ListIndex
Case 0
FieldName = "Emp_ID"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 1
FieldName = "Emp_Name"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 2
FieldName = "Emp_Sex"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 3
FieldName = "E_ID"
If Not dcmbItemValue.Visible Then
txtQueryValue.Visible = False
dcmbItemValue.Left = txtQueryValue.Left
dcmbItemValue.Top = txtQueryValue.Top
dcmbItemValue.Visible = True
End If
Set dcmbItemValue.RowSource = rctEdulevel
dcmbItemValue.BoundColumn = "E_ID"
dcmbItemValue.ListField = "E_Name"
dcmbItemValue.Text = ""
Case 4
FieldName = "P_ID"
If Not dcmbItemValue.Visible Then
txtQueryValue.Visible = False
dcmbItemValue.Left = txtQueryValue.Left
dcmbItemValue.Top = txtQueryValue.Top
dcmbItemValue.Visible = True
End If
Set dcmbItemValue.RowSource = rctPlitics
dcmbItemValue.BoundColumn = "P_ID"
dcmbItemValue.ListField = "P_Name"
dcmbItemValue.Text = ""
Case 5
FieldName = "Job_ID"
If Not dcmbItemValue.Visible Then
txtQueryValue.Visible = False
dcmbItemValue.Left = txtQueryValue.Left
dcmbItemValue.Top = txtQueryValue.Top
dcmbItemValue.Visible = True
End If
Set dcmbItemValue.RowSource = rctJobList
dcmbItemValue.BoundColumn = "Job_ID"
dcmbItemValue.ListField = "Job_Name"
dcmbItemValue.Text = ""
Case 6
FieldName = "Titel_ID"
If Not dcmbItemValue.Visible Then
txtQueryValue.Visible = False
dcmbItemValue.Left = txtQueryValue.Left
dcmbItemValue.Top = txtQueryValue.Top
dcmbItemValue.Visible = True
End If
Set dcmbItemValue.RowSource = rctTitelList
dcmbItemValue.BoundColumn = "Titel_ID"
dcmbItemValue.ListField = "Titel_Name"
dcmbItemValue.Text = ""
Case 7
FieldName = "MS_ID"
If Not dcmbItemValue.Visible Then
txtQueryValue.Visible = False
dcmbItemValue.Left = txtQueryValue.Left
dcmbItemValue.Top = txtQueryValue.Top
dcmbItemValue.Visible = True
End If
Set dcmbItemValue.RowSource = rctMarriageStatus
dcmbItemValue.BoundColumn = "MS_ID"
dcmbItemValue.ListField = "Ms_Name"
dcmbItemValue.Text = ""
Case 8
FieldName = "Emp_ID_cord"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 9
FieldName = "Emp_mobile_num"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 10
FieldName = "Emp_Tel_num"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 11
FieldName = "Emp_name_char"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
Case 12
FieldName = "Emp_Memo"
If Not txtQueryValue.Visible Then
txtQueryValue.Visible = True
dcmbItemValue.Visible = False
End If
End Select
End With
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Select Case stbQuery.Tab
Case 0
If cmbQueryItem.ListIndex <> 3 And _
cmbQueryItem.ListIndex <> 4 And _
cmbQueryItem.ListIndex <> 5 And _
cmbQueryItem.ListIndex <> 6 And _
cmbQueryItem.ListIndex <> 7 Then
If Trim(txtQueryValue.Text) = Empty Then
MsgBox "查询内容不能为空", vbInformation + vbOKOnly, "查询数据"
Exit Sub
Else
FieldValue = Trim(txtQueryValue.Text)
If cmbQueryItem.ListIndex = 2 Then
If Trim(txtQueryValue.Text) = "男" Then
FieldValue = 1
Else
If Trim(txtQueryValue.Text) = "女" Then
FieldValue = 0
Else
MsgBox "输入错误!", vbCritical + vbOKOnly, "查询数据"
Exit Sub
End If
End If
strFilter = FieldName & " = " & FieldValue
Else
If chkLike.Value = 1 Then
strFilter = FieldName & " like " & "'" & "%" & FieldValue & "%" & "'"
Else
strFilter = FieldName & " = " & "'" & FieldValue & "'"
End If
End If
End If 'end if Trim(txtQueryValue.Text) = Empty
Else
FieldValue = dcmbItemValue.BoundText
If cmbQueryItem.ListIndex = 7 Then
strFilter = FieldName & " = " & FieldValue
Else
strFilter = FieldName & " = " & "'" & FieldValue & "'"
End If
End If
Case 1
Operater = Combo1.List(Combo1.ListIndex)
strFilter = FieldName & " " & Operater & " " & "'" & dtpDateValue.Value & "'"
End Select
' MsgBox strFilter
rctEmployees.Filter = strFilter
frmEmployees.flexEmployees.Redraw = False
Call frmEmployees.IniGrid(frmEmployees.flexEmployees)
Call frmEmployees.ShowData(rctEmployees, frmEmployees.flexEmployees)
frmEmployees.flexEmployees.Redraw = True
End Sub
Private Sub Combo1_Click()
Operater = Combo1.List(Combo1.ListIndex)
End Sub
Private Sub Command1_Click()
rctEmployees.Filter = ""
frmEmployees.flexEmployees.Redraw = False
Call frmEmployees.IniGrid(frmEmployees.flexEmployees)
Call frmEmployees.ShowData(rctEmployees, frmEmployees.flexEmployees)
frmEmployees.flexEmployees.Redraw = True
End Sub
Private Sub Form_Load()
cmbQueryItem.AddItem "工作证号"
cmbQueryItem.AddItem "员工姓名"
cmbQueryItem.AddItem "员工性别"
cmbQueryItem.AddItem "文化程度"
cmbQueryItem.AddItem "政治面貌"
cmbQueryItem.AddItem "员工职务"
cmbQueryItem.AddItem "员工职称"
cmbQueryItem.AddItem "婚姻状况"
cmbQueryItem.AddItem "身份证号"
cmbQueryItem.AddItem "手机号码"
cmbQueryItem.AddItem "家庭电话"
cmbQueryItem.AddItem "字数拼音"
cmbQueryItem.AddItem "备注"
cmbQueryItem.ListIndex = 0 '默认第一项
cmbDateItem.AddItem "出生日期"
cmbDateItem.AddItem "参加工作日期"
cmbDateItem.AddItem "加入本单位日期"
cmbDateItem.ListIndex = 0
Combo1.ListIndex = 0 '默认第一项
stbQuery.Tab = 0 '默认第一项
FieldName = "Emp_ID" '默认第一次就选择员工工作证这个字段
dcmbItemValue.Visible = False '员工职务等的值的选择框不显示
End Sub
Private Sub stbQuery_Click(PreviousTab As Integer)
If stbQuery.Tab = 1 Then
chkLike.Visible = False
Else
chkLike.Visible = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -