老师,我想从筛选纯别墅小区,也就是小区的所有住宅的楼层都是在1-3层之间的,如果小区还有其他大于3层的住宅就不是纯别墅小区。我的主表楼层的数据有5列,我自己写的代码,无法满足要求,筛选的小区不是纯别墅付的小区,而是及有别墅也有其他楼层的小区。老师帮忙看看问题出在哪?下面是代码:With e.Form.Controls("是否纯别墅")
If .Value IsNot Nothing Then
If .Value = "是" Then
Dim filter4 As String
For i As Integer = 1 To 5
Dim f4 As String = ""
f4 = f4 & "(层数" & i & "值" & " > '1'" & " And " & "层数" & i & "值" & " <= '3')"
If filter4 >"" Then
filter4 = filter4 & " or "
End If
filter4 = filter4 & f4
Next
If filter4 > "" Then
msgbox(filter4 )
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "(" & filter4 & ")"
End If
Else
Dim filter4 As String
For i As Integer = 1 To 5
Dim f4 As String = ""
f4 = f4 & "层数" & i & "值" & " > '3' "
If filter4 >"" Then
filter4 = filter4 & " or "
End If
filter4 = filter4 & f4
Next
If filter4 > "" Then
msgbox(filter4 )
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "(" & filter4 & ")"
End If
End If
End If
End With
此主题相关图片如下:~j`x@x3~e5bh0vdi5t2t0j.png
