Dim Filter As String
With e.Form.Controls("控件1")
If .Value IsNot Nothing Then
Filter = "列名1 = '" & .Value & "'"
End If
End With
With e.Form.Controls("控件2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "列名2 = '" & .Value & "'"
End If
End With
With e.Form.Controls("控件3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "列名3 = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("表A").Filter = Filter
End If