以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  模糊筛选  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=174419)

--  作者:asionwong
--  发布时间:2022/1/14 12:34: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
If
Filter > "" Then
    Tables(
"订单").Filter = Filter
End If

如果需要改为模糊筛选,"="改为Like吗?请问怎么改?谢谢


--  作者:程兴刚
--  发布时间:2022/1/14 12:54: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
If 
Filter > "" Then
    Tables(
"订单").Filter = Filter
End If

--  作者:asionwong
--  发布时间:2022/1/14 13:25: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
If 
Filter > "" Then
    DataTables("订单_table1").LoadFilter = Filter
    DataTables("订单_table1").Load
End If

这个不行
[此贴子已经被作者于2022/1/14 13:27:35编辑过]

--  作者:有点蓝
--  发布时间:2022/1/14 13:39:00
--  

Filter = 
"产品 like \'%" & .Value & "%\'"