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.