以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]筛选  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=186101)

--  作者:miaoqingqing
--  发布时间:2023/4/6 13:26:00
--  [求助]筛选
Dim s1 As String  = e.Form.Controls("ComboBox1").text
Dim s2 As String  =e.Form.Controls("ComboBox2").Value
Dim s3 As String  =e.Form.Controls("ComboBox3").Value
Dim s4 As String  =e.Form.Controls("ComboBox4").Value
Dim s5 As String  =e.Form.Controls("ComboBox5").Value
Dim s6 As String  =e.Form.Controls("ComboBox6").Value
Dim s7 As String  =e.Form.Controls("ComboBox7").Value


Dim tb1234 As Table = Tables("表A")
Dim filter As String = "1=1"
If s1 > "" Then
    s1 = "\'%" & s1 & "%\'"
    filter = filter & " and 第一列 Like " & s1
End If

s2 = e.Form.Controls("ComboBox2").Text
If s2 > "" Then
    s2 = "\'%" & s2 & "%\'"
    filter = filter & " and 第一列 Like " & s2
End If


s3 = e.Form.Controls("ComboBox3").Text
If s3 > "" Then
    s3 = "\'%" & s3 & "%\'"
    filter = filter & " and 第一列 Like " & s3
End If


s4 = e.Form.Controls("ComboBox4").Text
If s4 > "" Then
    s4 = "\'%" & s4 & "%\'"
    filter = filter & " and 第一列 Like " & s4
End If
tb1234.filter = filter

上面代码,筛选出表A第一列值,含窗口控件1 2 3 4的值行,
求助,同时筛选出表A第一列值,含窗口控件1 2 3 5的值行

--  作者:有点蓝
--  发布时间:2023/4/6 13:42:00
--  
s4 = e.Form.Controls("ComboBox4").Text
If s4 > "" Then
    s4 = "\'%" & s4 & "%\'"
    filter = filter & " and 第一列 Like " & s4
End If
Dim filter2 As String = "1=1"
使用同样的方法设置第二个含窗口控件1 2 3 5的值条件
tb1234.filter = filter & “ or ” filter2