以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于筛选的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=176845)

--  作者:heejue
--  发布时间:2022/4/28 16:17:00
--  关于筛选的问题
设计了一个查询窗口,想要实现的目标是,在已筛选的表中进行查询,(在表中显示使用人和使用部门为空的行中再次筛选),用了下面的代码,无法实现,
这句 f = "[使用部门] is Null  And [使用人] Is Null " & f  好像不起作用. 会把使用人和使用部门不是空的也查询出来,是哪里有问题,如果搜索框没有输入 可以正确筛选出所有使用人和使用部门是空的行
请帮忙看看是哪里的问题.

图片点击可在新窗口打开查看


Dim s As String = e.Sender.Text
Dim ls As new List(of String)
For Each dc As DataCol In DataTables("资产明细").DataCols
    ls.add(dc.Name)
Next
ls.Remove("使用期限")
ls.Remove("购入日期")
ls.Remove("使用部门")
ls.Remove("使用人")
Dim f As String
For i As Integer = 0 To ls.Count - 1
    f = f  & " Or "  & ls(i) & " Like \'%" & s & "%\'"   
Next
\'f = f.Remove(0,4)
f = "[使用部门] is Null  And [使用人] Is Null " & f
If s = ""     \'搜索字删除时恢复原始帅选,否则按输入字符选择
    Tables("选择资产_资产选择").Filter = "[使用部门] is Null And [使用人] is Null"
Else
    Tables("选择资产_资产选择").Filter = f
End If
[此贴子已经被作者于2022/4/28 16:21:02编辑过]

--  作者:有点蓝
--  发布时间:2022/4/28 16:23:00
--  
f = f.Remove(0,4)
f = "[使用部门] is Null  And [使用人] Is Null and (" & f & ")"