以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  模糊查询  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=117179)

--  作者:yifan3429
--  发布时间:2018/4/8 11:55: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 e.Form.Controls("rdoYifu").Checked = True \' 如果付款状态选择了"已付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "赢单 = True"
End If
If e.Form.Controls("rdoWeifu").Checked = True \' 如果付款状态选择了"未付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "赢单 = False Or 赢单 Is Null"
End If
If Filter > "" Then
    Tables("终端用户").Filter = Filter
End If

--  作者:有点甜
--  发布时间:2018/4/8 11:59:00
--  

比如

 

Filter = Filter & "用户电话 = \'" & .Value & "\'"

 

改成

 

Filter = Filter & "用户电话 like \'%" & .Value & "%\'"