以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求助关于窗口加载数据的权限设置问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=52166)

--  作者:188802386
--  发布时间:2014/6/10 16:14:00
--  求助关于窗口加载数据的权限设置问题
我在查询按钮里面设置的代码如下
Dim Filter As String
With e.Form.Controls("ComboBox1")
    If .Value IsNot Nothing Then
        Filter = "所属区域 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("ComboBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "门店 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("ComboBox3")
    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 & "状态 Is Not Null"
End If
If e.Form.Controls("rdoWeifu").Checked = True \' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "状态 Is Null"
End If
If Filter > "" Then
    DataTables("佣金明细").LoadFilter = Filter
    DataTables("佣金明细").Load
End If
================================================================================
但是我想把用户的权限加进去,本来权限可以在项目属性里面设置 但我采用需要用的时候才加载该表,所以就有点糊涂了,不知道怎么来整合这两段代码了,请高手解决下 谢谢

\'实现使不同分组加载不同行且实现分页加载
If User.Group = "行政部" Then
    DataTables("佣金明细").LoadFilter = ""
ElseIf User.Group = "一片区" Then
    DataTables("佣金明细").LoadFilter = "所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "二片区" Then
    DataTables("佣金明细").LoadFilter = "所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "三片区" Then
    DataTables("佣金明细").LoadFilter = "所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "店面经理" Then
    DataTables("佣金明细").LoadFilter = "店面经理 = \'" & User.Name & "\'"
ElseIf User.Name = "开发者" Then
    DataTables("佣金明细").LoadFilter = ""
Else 
    DataTables("佣金明细").LoadFilter = "置业顾问 = \'" & User.Name & "\'"
End If
DataTables("佣金明细").LoadTop = 20
DataTables("佣金明细").LoadPage = 0

--  作者:Bin
--  发布时间:2014/6/10 16:17:00
--  
If Filter > "" Then
    DataTables("佣金明细").LoadFilter = Filter
    DataTables("佣金明细").Load
End If   

绿色这一段去掉
================================================================================
但是我想把用户的权限加进去,本来权限可以在项目属性里面设置 但我采用需要用的时候才加载该表,所以就有点糊涂了,不知道怎么来整合这两段代码了,请高手解决下 谢谢

\'实现使不同分组加载不同行且实现分页加载
If User.Group = "行政部" Then
    DataTables("佣金明细").LoadFilter = Filter 
ElseIf User.Group = "一片区" Then
    DataTables("佣金明细").LoadFilter = Filter & "   and 所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "二片区" Then
    DataTables("佣金明细").LoadFilter = Filter & "   and 所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "三片区" Then
    DataTables("佣金明细").LoadFilter = Filter & "   and 所属区域 = \'" & User.Group & "\'"
ElseIf User.Group = "店面经理" Then
    DataTables("佣金明细").LoadFilter = Filter & "   and 店面经理 = \'" & User.Name & "\'"
ElseIf User.Name = "开发者" Then
    DataTables("佣金明细").LoadFilter = Filter 
Else 
    DataTables("佣金明细").LoadFilter = Filter & "   and 置业顾问 = \'" & User.Name & "\'"
End If
DataTables("佣金明细").LoadTop = 20
DataTables("佣金明细").LoadPage = 0

DataTables("佣金明细").Load


--  作者:有点甜
--  发布时间:2014/6/10 16:18:00
--  

这段,改成

 

f Filter > "" Then

    DataTables("佣金明细").LoadFilter = Filter
    DataTables("佣金明细").Load
End If
 
改成
 
If Filter > "" Then
    If User.Group = "行政部" Then
        filter = filter
    ElseIf User.Group = "一片区" Then
        filter = filter & " and 所属区域 = \'" & User.Group & "\'"
    ElseIf User.Group = "二片区" Then
        filter = filter & " and 所属区域 = \'" & User.Group & "\'"
    ElseIf User.Group = "三片区" Then
        filter = filter & " and 所属区域 = \'" & User.Group & "\'"
    ElseIf User.Group = "店面经理" Then
        filter = filter & " and 店面经理 = \'" & User.Name & "\'"
    ElseIf User.Name = "开发者" Then
        filter = filter
    Else
        filter = filter & " and 置业顾问 = \'" & User.Name & "\'"
    End If
    DataTables("佣金明细").LoadTop = 20
    DataTables("佣金明细").LoadPage = 0
   
   
    DataTables("佣金明细").LoadFilter = Filter
    DataTables("佣金明细").Load
End If

--  作者:188802386
--  发布时间:2014/6/10 16:51:00
--  
谢谢