Database Security -- Adding a Group Account:   Return to List

Sub GroupAdd()
    Dim wks As Workspace
    Dim grpRegistrars As Group
    Dim strGroupPID As String
    Set wks = DBEngine(0)
    strGroupPID = "5678"
    ' Start by creating a new Group account
    Set grpRegistrars = wks.CreateGroup("Registrars")
    ' Now set the Group's properties
    grpRegistrars.PID = strGroupPID
    ' Append Group to the Groups collection of this workspace
    wks.Groups.Append grpRegistrars
End Sub


******** Alternative example ***********
Create a new group called Managers:

Sub CreateNewGroup()
    Dim ws As Workspace
    Dim newGrp As Group
    Set ws = DBEngine.Workspaces(0)
    Set newGrp = ws.CreateGroup("Managers", "1234")
    With ws.Groups
        .Append newGrp
        .Refresh
    End With
End Sub



Note to Webmaster