以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于多列筛选问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=140734) |
-- 作者:wangjx817 -- 发布时间:2019/9/12 13:10:00 -- 关于多列筛选问题 老师,我想从筛选纯别墅小区,也就是小区的所有住宅的楼层都是在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 |
-- 作者:有点蓝 -- 发布时间:2019/9/12 13:56:00 -- 把数据路的“层”、“幢”这些字符去掉,有必要存在吗?然后改为整数列进行处理 |
-- 作者:wangjx817 -- 发布时间:2019/9/12 15:35:00 -- 表格中的单位可以忽略不计!上述表格的数据就是前面的代码筛选出来,我想问老师假如上述表格的数据是没单位,筛选纯别墅小区代码怎么修改? |
-- 作者:有点蓝 -- 发布时间:2019/9/12 15:50:00 -- Dim filter4 As String With e.Form.Controls("是否纯别墅") If .Value = "是" Then For i As Integer = 1 To 5 If filter4 > "" Then filter4 = filter4 & " or " End If filter4 = filter4 & "(层数" & i & " > 1 And 层数" & i & " <= 3)" Next End If End With tables().filter = filter4
|
-- 作者:wangjx817 -- 发布时间:2019/9/16 10:41:00 -- 测试效果不对,我想到达如下纯别墅小区的筛选效果。 |
-- 作者:有点蓝 -- 发布时间:2019/9/16 11:11:00 -- 上传具体实例说明 |