Programmaticaly Add user to secured dbase (1 Viewer)

Smart

Registered User.
Local time
Today, 13:05
Joined
Jun 6, 2005
Messages
436
Can anyone help please

How do you add a user to asecured database using vb

Thanks
 

Dennisk

AWF VIP
Local time
Today, 13:05
Joined
Jul 22, 2004
Messages
1,649
According to the bible (Building applications with Access 97) you can add users to a group by appending the User object to the users collection of an existing group.

Code:
Sub CreateUser()
    dim ws as workspace
    dim grpVp as group, grpmanager as Group
    Dim usr as User
' Create a new group

    Set ws = DBEngine.Workspaces(0)
    Set grpVp = ws.CreateGroup("Testgroup","mmbht101193")
    ws.Groups.Append grpVp
    ws.groups.refresh

    ' create an instance of an existing user account, add the user
    ' to the new group, then remove the use
    
     Set user = grpVp.CreateUser("New User")
     grpVp.Users.Append usr
     grpVp.Users.Refresh

     Set grpManager = ws.Groups("managers")
     grpManager.Users.Delete "Test User"
     grpmanager.Users.Refresh
End Sub
 

Users who are viewing this thread

Top Bottom