以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 求模糊筛选代码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=2104) |
||||
-- 作者:老有所乐 -- 发布时间:2009/3/14 22:55:00 -- 求模糊筛选代码 在窗口的文本框中输入要找到关键字,如输入“西”,点击“模糊筛选”按钮,就能筛选出第4行(第二列),6行(第三列),7行(备注)包含有“西”字的行. 求“模糊筛选”按钮代码
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2009/3/14 23:08:00 -- Dim Filter As String = "" Dim Val As String = "西" For each c As col In CurrentTable.Cols If c.IsString Then If Filter > "" Then Filter = Filter & " Or " End If Filter = Filter & c.Name & " Like \'*" & Val & "*\'" End If Next CurrentTable.Filter = Filter |
||||
-- 作者:舜风 -- 发布时间:2009/3/14 23:23:00 -- 第一、定义全局变量 “搜索” 第二、按键设置代码如下: Dim str As String = e.Form.Controls("TextBox42").Value If str is nothing Then MsgBox("提示: 空值等于筛选全部! ",64,"提示") end if Tables("表一").Filter = "[列名1] Like \'*" & Vars("搜索") & "*\' Or [列名2] Like \'*" & Vars("搜索") & "*\'" |
||||
-- 作者:程兴刚 -- 发布时间:2009/3/14 23:55:00 -- Dim Filter As String = "" Dim Val As String = Forms("窗口1").Controls("TextBox1").Value if Val is nothing then MessageBox.Show("对不起,请先输入查找内容!", "提示") Else For each c As col In CurrentTable.Cols If c.IsString Then If Filter > "" Then Filter = Filter & " Or " End If Filter = Filter & c.Name & " Like \'*" & Val & "*\'" End If Next CurrentTable.Filter = Filter end if |
||||
-- 作者:老有所乐 -- 发布时间:2009/3/15 7:19:00 -- 谢谢贺老师,程老师,谢谢舜风先生! |