Dim filter2 As String
For i As Integer = 1 To 4
Dim f2 As String = ""
With e.Form.Controls("走访开始")
If .Value IsNot Nothing Then
f2 = f2 & "走访记录" & i & " >= #" & .Value & "# "
End If
End With
With e.Form.Controls("走访结束")
If .Value IsNot Nothing Then
If f2 >"" Then
f2 = f2 & " And "
End If
f2 = f2 & "走访记录" & i & " <= #" & .Value & "# "
End If
End With
If filter2 >"" Then
filter2 = filter2 & " or "
End If
filter2 = filter2 & f2
Next
If filter2 > "" Then
msgbox(filter2 )
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & filter2
End If
If Filter >"" Then
Tables("住宅小区基础信息表_住宅小区信息汇总表").Filter = Filter
End If