Home All Groups Group Topic Archive Search About

programmatically delete user in group

Author
13 Mar 2007 2:15 AM
troubleD
Hi,

I am trying to delete a user from the group but I always
get a data type mismatch in -  grpUsers.Users.Delete usr ?

       Dim db As Database
       Dim ws As Workspace
       Dim usr As User
       Dim grpUsers As Group


            Set ws = DBEngine.Workspaces(0)
            Set grpUsers = ws.Groups("Admins"
            Set usr = grpUsers.Users("userTwo")

            grpUsers.Users.Delete usr
            grpUsers.Users.Refresh


What have I done wrong ?

Thank you so much!

Author
15 Mar 2007 5:51 PM
Joan Wild
Dim ws As Workspace
Dim grpUsers as Group
Dim usr as User

Set ws = DBEngine.Workspaces(0)
Set grpUsers = ws.Groups("Admins")
Set usr = grpUsers.CreateUser("userTwo")

grpUsers.Users.Delete usr
grpUsers.Users.Refresh


--
Joan Wild
Microsoft Access MVP
Show quoteHide quote
"troubleD" <troub***@discussions.microsoft.com> wrote in message
news:6E60B7D0-E11C-435E-AD6C-4602E613FF26@microsoft.com...
> Hi,
>
> I am trying to delete a user from the group but I always
> get a data type mismatch in -  grpUsers.Users.Delete usr ?
>
>       Dim db As Database
>       Dim ws As Workspace
>       Dim usr As User
>       Dim grpUsers As Group
>
>
>            Set ws = DBEngine.Workspaces(0)
>            Set grpUsers = ws.Groups("Admins"
>            Set usr = grpUsers.Users("userTwo")
>
>            grpUsers.Users.Delete usr
>            grpUsers.Users.Refresh
>
>
> What have I done wrong ?
>
> Thank you so much!