分用户组权限查看相应的内容
时 间:2017-09-04 16:32:00
作 者:听_feng ID:62777 城市:成都
摘 要:根据不同用户组显示不同的结果。
部门负责人查看该部门所有数据,普通成员查看当前用户的数据
正 文:
a. 建立相应的用户组
b. 建立用户组查询
c. 在相关的表中加入用户字段
c. 在窗体代码中加入权限代码
Private Sub Form_Load()
Set mclsQuery = New GeneralQuery
With mclsQuery
.QueryForm = Me.sfrQuickQuery
.DataForm = Me.sfrList
.AddAllFields
.FieldName = "xmID"
End With
'---------------------分权限管理代码段开始----------------------'
Dim Role As String
Role = Forms!SysFrmMain!RoleName
Select Case Role
Case "系统管理员"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject"
Case "总经理"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject"
Case "市场部负责人"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject"
Case "市场部"
Me.sfrListMe.sfrList.Form.RecordSource = "Select * FROM qryProject"
Case "北京销售组负责人"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname in (Select Nickname from qryUser_SalesGrpBj)"
'查询北京销售组所有成员的信息
Case "北京销售组"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname = Forms!SysFrmMain!Nickname"
Case "上海销售组负责人"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname in (Select Nickname from qryUser_SalesGrpSh)"
'查询上海销售组所有成员的信息
Case "上海销售组"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname = Forms!SysFrmMain!Nickname"
Case "成都销售组负责人"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname in (Select Nickname from qryUser_SalesGrpCd)"
'查询成都销售组所有成员的信息
Case "成都销售组"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname = Forms!SysFrmMain!Nickname"
Case "技术部负责人"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Tech.Nickname in (Select Nickname from qryUser_Tech)"
'查询技术部所有成员的信息
Case "技术部"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Tech.Nickname = Forms!SysFrmMain!Nickname"
Case Else
MsgBox "对不起,您无权查看此内容!"
Me.sfrList.Form.RecordSource = "Select * FROM qryProject Where qryUser_Sales.Nickname = Null"
End Select
'---------------------分权限管理代码段结束----------------------'
Me.Recalc
End Sub
但是发现执行效率比较低,还望大家帮忙优化一下
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 统计当月之前(不含当月)的记录...(03.11)
- 【Access Inputbo...(03.03)
- 按回车键后光标移动到下一条记录...(02.12)
- 【Access Dsum示例】...(02.07)
- Access对子窗体的数据进行...(02.05)
- 【Access高效办公】上月累...(01.09)
- 【Access高效办公】上月累...(01.06)
- 【Access Inputbo...(12.23)
- 【Access Dsum示例】...(12.16)

学习心得
最新文章
- 仓库管理实战课程(9)-开发往来单...(04.02)
- 仓库管理实战课程(8)-商品信息功...(04.01)
- 仓库管理实战课程(7)-链接表(03.31)
- 仓库管理实战课程(6)-创建查询(03.29)
- 仓库管理实战课程(5)-字段属性(03.27)
- 设备装配出入库管理系统;基于Acc...(03.24)
- 仓库管理实战课程(4)-建表操作(03.22)
- 仓库管理实战课程(3)-需求设计说...(03.19)
- 仓库管理实战课程(2)-软件背景和...(03.18)
- 仓库管理实战课程(1)-讲师介绍(03.16)