Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]再问窗口筛选_可否实现输入的多条件都实现模糊筛选?

1楼
ddlzq 发表于:2010/4/27 21:13: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("cmbCustomer")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("cmbEmployee")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = 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 Filter > "" Then
    Tables("订单").Filter = Filter
End If
---------------
以上代码是帮助中的‘窗口筛选’例表中的代码,但这个是完全条件的筛选,可否改成组合框输入条件后,自动变成“包含”式筛选呢?搜了一下咱们论坛的“模糊筛选”没太懂,能不能哪位老师教一下?谢谢了。
2楼
czy 发表于:2010/4/27 22:16:00

这样?

Dim Filter As String
With e.Form.Controls("cmbProduct")
    If .Value IsNot Nothing Then
        Filter = "产品 Like '*" & .Value & "*'"
    End If
End With
With e.Form.Controls("cmbCustomer")
    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("cmbEmployee")
    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("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 Filter > "" Then
    Tables("订单").Filter = Filter
End If

3楼
ddlzq 发表于:2010/4/28 7:59:00
太感谢CZY老师了!这么晚还在论坛上,我都研究的睡过去了,呵呵。一早就像中彩piao一样就收到了满意 的回复。
[此贴子已经被作者于2010-4-28 7:59:48编辑过]
4楼
blackzhu 发表于:2010/4/28 17:04:00
以下是引用ddlzq在2010-4-28 7:59:00的发言:
太感谢CZY老师了!这么晚还在论坛上,我都研究的睡过去了,呵呵。一早就像中彩piao一样就收到了满意 的回复。
[此贴子已经被作者于2010-4-28 7:59:48编辑过]

在版中查yang版以前做的例子可以模糊筛选的.

共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03906 s, 2 queries.