Hi I'm trying to access the group name of a security group i set up in access. What is the syntax?? I can get the username of the peson logged in but i can't get the groupname. Any help will be greatly appreciated
------
Sub CheckUserPermsInAccess(strUser As String, _
varObjName As Variant, _
lngCheckRights As ADOX.RightsEnum, _
lngObjectType As ADOX.ObjectTypeEnum, _
Optional lngObjID As opgObjectID)
Dim catDB As ADOX.Catalog
Dim lngCurrentRights As Long
Dim varObjectID As Variant
' If lngObjID was specified, call SetObjID procedure to set
' varObjectID to the corresponding Access object ID constant.
If lngObjID > 0 Then
varObjectID = SetObjID(lngObjID)
End If
Set catDB = New ADOX.Catalog
With catDB
' Open Catalog object by using connection to current database.
.ActiveConnection = CurrentProject.Connection
' Retrieve the current set of permissions for the group.
lngCurrentRights = .Users(strUser).GetPermissions(varObjName, lngObjectType, _
varObjectID)
End With
' If varObjName is not Null, then caller is
' checking permissions for a specific object.
If Not IsNull(varObjName) Then
' Check to see if lngCurrentRights is exactly
' adRightNone or adRightFull.
If lngCurrentRights = adRightNone Then
Debug.Print strUser & " has no permissions for " & varObjName
ElseIf lngCurrentRights = adRightFull Then
Debug.Print strUser & " has full permissions for " & varObjName
' Otherwise, use And operator to check if lngCheckRights
' is part of the current permissions bitmask.
ElseIf (lngCurrentRights And lngCheckRights) > 0 Then
Debug.Print strUser & " has the specified permissions for " & varObjName
' User doesn't have the specified permissions.
Else
Debug.Print strUser & " doesn't have the specified permissions for " _
& varObjName
End If
' Otherwise, the varObjName object variable is Null, so the caller
' is checking permissions for new objects of the specified object
' type (in DAO, a Container object).
Else
If lngCurrentRights = adRightNone Then
Debug.Print strUser & " has no permissions for all new objects of " _
& "the specified type."
ElseIf lngCurrentRights = adRightFull Then
Debug.Print strUser & " has full permissions for all new objects of " _
& "the specified type."
ElseIf (lngCurrentRights And lngCheckRights) > 0 Then
Debug.Print strUser & " has the specified permissions for all new " _
& "objects of the specified type."
Else
Debug.Print strUser & " doesn't have the specified permissions for " _
& "all new objects of the specified type."
End If
End If
' Display current permissions in the Immediate window.
Debug.Print DecodePerms(lngCurrentRights)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.