参考:http://www.foxtable.com/webhelp/topics/1058.htm,比如
Dim str() As String = {"外框","内叶","安装"}
Dim Filter As String = "1=2"
For Each s As String In str
Filter = Filter & "or ("
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = s & "完成人员 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter &s & "完成时间 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("endDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter &s & "完成时间 <= #" & .Value & "#"
End If
End With
Filter = Filter & ")"
Next
msgbox(Filter )
……