以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]合并代码  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=16476)

--  作者:dqlgood
--  发布时间:2012/2/15 11:39:00
--  [求助]合并代码
 在“表A”项目“二级分类”已选择的情况项下筛选,如何将如下两段编码合并?

 

Dim txt As String = e.Form.Controls("TextBox1").Text

Dim tbl As Table = Tables("表A")

If txt = "" Then

    tbl.Filter = ""

Else

    txt = "\'*" & txt & "*\'"

\'条件一

tbl.Filter = "项目名称 Like " & txt & " Or 拼音缩写 Like " & txt

\'条件二

Tables("表A").Filter = "[一级分类] = \'" & Tables("加载项").Current("一级分类") & "\'And [二级分类] = \'" & Tables("加载项").Current("二级分类") &"\'"


[此贴子已经被作者于2012-2-15 11:47:10编辑过]

--  作者:狐狸爸爸
--  发布时间:2012/2/15 11:50:00
--  

Tables("表A").Filter = "([一级分类] = \'" & Tables("加载项").Current("一级分类") & "\'And [二级分类] = \'" & Tables("加载项").Current("二级分类") & "\') And (项目名称 Like " & txt & " Or 拼音缩写 Like " & txt & ")"