以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  管理员不受限制  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137904)

--  作者:有点蓝
--  发布时间:2019/7/18 10:15:00
--  
With DataTables("采购报价明细_采购报价订单")
    Dim filter = "[部门] = \'管理员\'"
    Dim str = ""
    For Each s As String In _UserGroup.split(",")
        str &= " or [部门] = \'" & s & "\'"
    Next
    filter &= " or (" & str.Substring(3) & ")"
    .LoadFilter = filter
    .LoadTop = 1000
    .LoadPage = 0
    .Load()
End With
--  作者:有点蓝
--  发布时间:2019/7/18 10:42:00
--  
With DataTables("采购报价明细_采购报价订单")
if user.name = "管理员"
 .LoadFilter = “”
else
    Dim filter = "\'"
    Dim str = ""
    For Each s As String In _UserGroup.split(",")
        str &= " or [部门] = \'" & s & "\'"
    Next
    filter &= " (" & str.Substring(3) & ")"
    .LoadFilter = filter
end if
    .LoadTop = 1000
    .LoadPage = 0
    .Load()
End With

--  作者:有点蓝
--  发布时间:2019/7/18 11:25:00
--  
学会调试:

msgbox(filter)

--  作者:狐狸爸爸
--  发布时间:2019/7/18 11:44:00
--  
With DataTables("采购报价明细_采购报价订单")
    If user.name = "管理员"
        .LoadFilter = ""
    Else
        Dim filter = "\'"
        Dim str = ""
        For Each s As String In _UserGroup.split(",")
            If str = "" Then
                strl  = "[部门] = \'" & s & "\'"
            Else
                str  = str  & " or [部门] = \'" & s & "\'"
            End If
        Next
        filter &= " (" & str.Substring(3) & ")"
        .LoadFilter = filter
    End If
    .LoadTop = 1000
    .LoadPage = 0
    .Load()
End With

--  作者:cd_tdh
--  发布时间:2019/7/18 13:40:00
--  

做可视授权,你这样写表多了,要写死人。

 


--  作者:有点蓝
--  发布时间:2019/7/18 13:41:00
--  
With DataTables("采购报价明细_采购报价订单")
    If _UserName = "管理员"
        .LoadFilter = ""
    Else
        Dim filter = "[部门] in (\'" & _UserGroup.replace(",","\',\'") & "\')"
        msgbox(filter)
        .LoadFilter = filter
    End If
    .LoadTop = 1000
    .LoadPage = 0
    .Load()
End With