or 条件,要加上括号
DataTables("b1").Save()
Dim Filter1 As String
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
Filter1 = "(a1 <= '" & .Value & "' or a1 is null)"
End If
End With
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "(a21 >= '" & .Value & "' or a21 is null)"
End If
End With
With e.Form.Controls("TextBox2")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "(a11 >= '" & .Value & "' or a11 is null)"
End If
End With
With e.Form.Controls("ComboBox6")
If .Value IsNot Nothing Then
If Filter1 >"" Then
Filter1 = Filter1 & " And "
End If
Filter1 = Filter1 & "(a17 like '%" & .Value & "%' or a17 is null)"
End If
End With
If Filter1 > "" Then
Tables("a1").Filter = Filter1
End If