以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 筛选条件疑问 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=57542) |
-- 作者:tuyage -- 发布时间:2014/9/26 11:53:00 -- 筛选条件疑问 我的筛选条件总共有5个,5个条件里面如入任何一个筛选都可以筛选,但是筛选显示的结果只有5个单元格里都有内容的才会在结果中显示,什么情况。 我是用and连接表达式的,如果用Or直接就无法筛选。。哪里问题,下面是我的筛选表达式请参看。 Dim hyxm As WinForm.TextBox = e.Form.Controls("会员姓名") Dim hykh As WinForm.TextBox = e.Form.Controls("会员卡号") Dim hjgw As WinForm.ComboBox = e.Form.Controls("会籍顾问") Dim hydh As WinForm.TextBox = e.Form.Controls("会员电话") Dim hyjb As WinForm.ComboBox = e.Form.Controls("会员级别") Tables("会员信息表").Filter = "会员姓名 like \'*" & hyxm.Text & "*\' and 会员卡号 like \'*" & hykh.Text & "*\' and 会籍顾问 like \'*" & hjgw.Text & "*\' and 手机号码 like \'*" & hydh.Text & "*\' and 会员级别 like \'*" & hyjb.Text & "*\'" [此贴子已经被作者于2014-9-26 11:55:14编辑过]
|
-- 作者:有点甜 -- 发布时间:2014/9/26 11:55:00 -- 这宗筛选,参考这里做
http://www.foxtable.com/help/topics/1058.htm
|
-- 作者:tuyage -- 发布时间:2014/9/26 12:15:00 -- 我参照那个写了如下代码,筛选不起作用啊 Dim Filter As String With e.Form.Controls("ssjl") If .Value IsNot Nothing Then Filter = "教练姓名 = \'" & .Value & "\'" End If End With With e.Form.Controls("kclx") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "私教类型 = \'" & .Value & "\'" End If End With With e.Form.Controls("xydh") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "手机号码 = \'" & .Value & "\'" End If End With With e.Form.Controls("xyxm") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "学员姓名 >= #" & .Value & "#" End If End With |
-- 作者:tuyage -- 发布时间:2014/9/26 12:20:00 -- 能否在我原来的表达式中,把哪里改一下,使得如果表中某一个有筛选条件的单元格为空内容,还是可以通过其他条件筛选显示出来 |
-- 作者:有点甜 -- 发布时间:2014/9/26 14:01:00 -- 最后要写
Tables("会员信息表").Filter = Filter
不会做的话,句上传例子。 |
-- 作者:有点甜 -- 发布时间:2014/9/26 14:02:00 -- Dim Filter As String
With e.Form.Controls("ssjl")
If .Value IsNot Nothing Then
Filter = "教练姓名 Like \'%" & .Value & "%\'"
End If
End With
With e.Form.Controls("kclx")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "私教类型 Like \'%" & .Value & "%\'"
End If
End With
With e.Form.Controls("xydh")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "手机号码 Like \'%" & .Value & "%\'"
End If
End With
With e.Form.Controls("xyxm")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "学员姓名 Like \'%" & .Value & "%\'"
End If
End With
Tables("会员信息表").Filter = Filter |
-- 作者:tuyage -- 发布时间:2014/9/26 14:09:00 -- 果然是这个的缘故啊,万能的甜老师,新人笨还望多包涵 |