以下是按照实例做的
窗口与控件事件
筛选查询_Button1_Click
Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "项目进度= '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "专线类型 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "计费 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "协议 = '" & .Value & "'"
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
If Filter > "" Then
Tables("表A").Filter = Filter
End If
筛选查询_Button2_Click
e.Form.Controls("ComboBox1").Value = Nothing
e.Form.Controls("ComboBox2").Value = Nothing
e.Form.Controls("ComboBox3").Value = Nothing
e.Form.Controls("ComboBox4").Value = Nothing
e.Form.Controls("DateTimePicker1").Value = Nothing
e.Form.Controls("DateTimePicker2").Value = Nothing
筛选查询_Button3_Click
Tables("表A").ApplyFilter = False
谁能帮我看看有什么问题