我在查询按钮里面设置的代码如下
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