以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  我也发一个通用表格筛选无错版  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=135488)

--  作者:nxhylczh
--  发布时间:2019/5/27 20:50:00
--  我也发一个通用表格筛选无错版

Dim tbl As Table=e.Form.Controls("Table1").Table

Dim txt As String = trim(e.Sender.Text)

Try

If txt = "" Then

    tbl.Filter = ""

Else

    txt  = "\'%" & Functions.Execute("RealStr",txt) & "%\'"

    Dim Filter As String

    For Each c As Col In tbl.Cols

        If  c.IsString Then

            Filter=Filter & c.name &" Like " & txt & " Or "

        Else If c.IsNumeric AndAlso IsNumeric(txt) Then

            Filter=Filter & c.Name  & "="& replace( replace(txt,"\'",""),"%","") & " Or "

         End If

    Next

    Filter=left(Filter,Filter.Length-3)   \'此处的代码 我记得有一个endWiths("Or") ? 具体想不起来了

    tbl.filter=Filter

End If

Catch ex As Exception

End Try