以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  筛选查询  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=137404)

--  作者:admin22327
--  发布时间:2019/7/4 23:54:00
--  筛选查询
Dim Filter As String
\'With e.Form.Controls("cmbProduct")
   \' If .Value IsNot Nothing Then
    \'    Filter = "供应商名称 = \'" & .Value & "\'"
   \' End If
\'End With

With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With

If e.Form.Controls("rdoYifu").Checked = True \' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "已付款 = True"
End If
If e.Form.Controls("rdoWeifu").Checked = True \' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "已付款 = False Or 已付款 Is Null"
End If
If Filter > "" Then
    Tables("采购汇总表_Table1").Filter = Filter
End If
Tables("采购汇总表_Table1").Cols("金额").GrandTotal = True \'合计
Tables("采购汇总表_Table1").GrandTotal = True

在这个查询的基础上继续使用下面代码筛选,怎么可以组合起来
Dim txt As String = e.Form.Controls("TextBox2").Text
Dim tbl As Table =  Tables("采购汇总表_Table1")
If txt = "" Then
    tbl.Filter = ""
Else
    txt = "\'%" & txt & "%\'"
    tbl.Filter =  "货品名称 Like " & txt & " Or 仓库 Like " & txt  & " Or 规格 Like " & txt   & " Or 供应商名称 Like " & txt  & " Or 条形码 Like " & txt 
End If

--  作者:有点蓝
--  发布时间:2019/7/5 10:09:00
--  
tbl.Filter = IIF(tbl.Filter > "",tbl.Filter & " and ","") &  "(货品名称 Like " & txt & " Or 仓库 Like " & txt  & " Or 规格 Like " & txt   & " Or 供应商名称 Like " & txt  & " Or 条形码 Like " & txt & ")"