|
呵呵,我刚做过的,当然是在各版主的帮助下完成的。
Function 权限(类型 As String) As Boolean '类型为安全工作组中的组名称。用于查看当前用户是否归属于该组。
Dim Rs As New ADODB.Recordset
Dim Sql As String
Dim StrPath As String
StrPath = CurrentProject.Path & "\sys.mdw" ' 同目录下的工作组文件。
Rs.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Trim(StrPath) + ";"
Sql = "SELECT DISTINCT MSysAccounts_1.Name FROM (MSysAccounts INNER JOIN MSysGroups ON MSysAccounts.SID = MSysGroups.GroupSID) INNER JOIN MSysAccounts AS MSysAccounts_1 ON MSysGroups.UserSID = MSysAccounts_1.SID WHERE (((MSysAccounts_1.Name)=CurrentUser()) AND ((MSysAccounts.Name)='" & 类型 & "'));"
Set Rs = Rs.ActiveConnection.Execute(Sql)
If Rs.EOF Then
权限 = False
Else
权限 = True
End If
Set Rs = Nothing
End Function
Private Sub Form_Current()
If 权限("超级用户") = True Then'安全工作组中有一个“超级用户”组,归入该组的人有审核权。
Me.复核.Enabled = True
Me.经办人.Locked = False
Else
Me.复核.Enabled = False
Me.经办人.Locked = True
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
If 权限("查看组") = False Then '如果该用户有归属于查看组(老大和审批人),则显示所有记录,否则就只显示自己经办的记录。
Me.Filter = "[经办人] like '" & CurrentUser() & "*'"
Me.FilterOn = True
End If
DoCmd.GoToRecord , , acLast
End Sub |
|