Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Security / May 2008

Tip: Looking for answers? Try searching our database.

Remove user from group

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott Whetsell, A.S.  -  WVSP - 04 May 2008 03:25 GMT
I am trying to build a form that will allow those in supervisory positions to
be able to assign other users to different levels of access according to
group policy.  I can get the Groups.Users.Append to work fine, but when I use
Groups.Users.Delete I get a 'Type Mismatch' error on the .Delete.

Here is a sniplet of the code I am using.

============START SNIPLET============
Dim CurrLvl As String          ' Current Access Group
Dim NewLvl As String          ' New Access Group
CurrLvl = Me.CurrAccLvl
NewLvl = Me.NewAccLvl
strUID = Me.txtCPWUserName
Set wrk = DBEngine.Workspaces(0)
With wrk
   If CurrLvl = "View Only" Then
       Set grpUsers = wrk.Groups("View Only")
       Set usr = grpUsers.CreateUser(strUID)
       grpUsers.Users.Delete usr
       grpUsers.Users.Refresh
       If (NewLvl = "Admins") Or (NewLvl = "Supervisors") Then
           Set grpUsers = wrk.Groups("Admins")
           Set usr = grpUsers.CreateUser(strUID)
           grpUsers.Users.Append usr
           grpUsers.Users.Refresh
           If NewLvl = "Supervisors" Then
               Set grpUsers = wrk.Groups("Supervisors")
               Set usr = grpUsers.CreateUser(strUID)
               grpUsers.Users.Append usr
               grpUsers.Users.Refresh
           End If
       End If
============END SNIPLET============

My current user groups are Admins, Supervisors, Users, and View Only.
Admins and Users are the standard built in accounts.
Supervisors are also in the Admins group so they can add/change users, but
restricted from other Admin privledges.
View Only users are just that, they have read permissions only.

Thanks in advance.
Joan Wild - 04 May 2008 15:52 GMT
You don't need the .CreateUser() to delete them
Try simply

If CurrLvl = "View Only" Then
   Set usr = wrk.Users(strUID)
   usr.Groups.Delete "ViewOnly"
...

Signature

Joan Wild
Microsoft Access MVP
"Scott Whetsell, A.S. - WVSP" <ScottWhetsellASWVSP@discussions.microsoft.com> wrote in message news:3C074DEB-16EF-49F1-83CC-DCC53261FDF2@microsoft.com...

>I am trying to build a form that will allow those in supervisory positions to
> be able to assign other users to different levels of access according to
[quoted text clipped - 37 lines]
>
> Thanks in advance.
Scott Whetsell, A.S.  -  WVSP - 04 May 2008 20:41 GMT
Joan,

Thanks for pointing me in the painfully obvious direction again!  :)

Take care.

> You don't need the .CreateUser() to delete them
> Try simply
[quoted text clipped - 45 lines]
> >
> > Thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.