以文本方式查看主题

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

--  作者:有点甜
--  发布时间:2019/6/28 16:58:00
--  

If _UserGroup = "管理员" Then
    Filter =  filter
Else

dim str as string = ""

for each bm as string in _UserGroup.split(",")
    str &=  " or [部门] = \'" & bm & "\'"

next

str = "(" & str.substring(3) & ")"

msgbox(str)

 

filter = str & iif(filter>"", filter, "1=1")
End If


--  作者:有点甜
--  发布时间:2019/6/28 18:14:00
--  

 

请贴出完整代码,弹出最后的msgbox(filter)看看

 

 


--  作者:有点蓝
--  发布时间:2019/6/28 20:29:00
--  
Dim Filter As String
With e.Form.Controls("中康编码3")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "中康编码 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("客户名称1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 like \'%" & .Value & "%\'"
    End If
End With
If _UserGroup <> "管理员" AndAlso _UserGroup > "" Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Dim str As String = "1=2"
    For Each bm As String In _UserGroup.split(",")
        str &=  " or [部门] = \'" & bm & "\'"
    Next
    filter = filter & "(" & str & ")"
End If
msgbox(str) \'这里弹出什么内容
e.Form.controls("客户名称").Table.DataTable.LoadPage = 0
e.Form.controls("客户名称").Table.DataTable.LoadFilter = filter
e.Form.controls("客户名称").Table.DataTable.Load
Tables("客户资料管理_客户名称").Sort = "添加日期 DESC"