下次提这样的问题请上传附件,否则很难得到回复的。
将原窗口中的textbox3控件换成CheckedComboBox1。
Dim Filter As String
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "姓名 = '" & .Value & "'"
End If
End With
With e.Form.Controls("TextBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "隶属类别 = '" & .Value & "'"
End If
End With
With e.Form.Controls("CheckedComboBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
If .Value.Contains(",") Then
Filter = Filter & "假别 In (" & "'" & .Value.Replace(",","','") & "')"
Else
Filter = Filter & "假别 = '" & .Value & "'"
End If
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "请假日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "请假日期<= #" & .Value & "#"
End If
End With