'授权加载数据
_dat = "commission"
Dim dr As DataRow = DataTables("users").SQLFind("姓名 ='" & _xingming & "'")
If dr Is Nothing OrElse dr.IsNull("加载范围集合") Then
DataTables(_dat).LoadFilter = "1"
DataTables(_dat).load
Else
Dim dtn() As String = dr("加载范围集合").split(",")
For Each tn As String In dtn
Dim ts() As String = tn.Split("|")
Select Case ts(0)
Case "佣金管理"
Select Case ts(1)
Case "本部"
DataTables(_dat).LoadFilter = "部门名称 in ('" & dr("本部集合").replace(",","','") & "')"
Case "所有"
DataTables(_dat).LoadFilter = "公司编号 = '" & _gsbh & "'"
Case Else
DataTables(_dat).LoadFilter = "置业顾问 ='" & _xingming & "'"
End Select
End Select
DataTables(_dat).load
Next
End If
上面是通过授权来判断某人可以看那些内容,但窗口中又设置了一些按钮,点击查询后,能否将筛选出来的内容在通过授权来判断的权限查看内容以内,下面是窗口的按钮,望高手帮忙合并一下,谢谢
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("ComboBox4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "状态 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox5")
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
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "成交日期 >= '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "成交日期 <= '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= '" & .Value & "'"
End If
End With
If Filter > "" Then
DataTables("commission").LoadFilter = Filter
DataTables("commission").Load
End If
[此贴子已经被作者于2018/1/5 16:01:46编辑过]