S
Stapes
Hi
I have set up my database with a workgroup, groups & users, and have
successfully made a form that allows certain users to add users,
delete users or add a user to a group, display all the Group / User
info or all the Permissions in the Containers collection. But can I
assign permissions to access forms and tables in code?
This is how I add a user: -
Private Sub Command1_Click()
On Error GoTo Command1_Click_Err
' Add User
MsgBox Newuser & "," & Newgroup & "," & Newpid & "," & Newpw & vbCrLf
& _
"Caution: The new Group / User will not appear in the Group / User
window" & vbCrLf & _
" until you close" & _
" the database & re-open it"
Dim wrkDefault As Workspace
Dim usrNew As User
Dim usrLoop As User
Dim grpNew As Group
Dim grpLoop As Group
Dim grpMember As Group
Dim GrpUsrInfo As String
GrpUsrInfo = ""
Set wrkDefault = DBEngine.Workspaces(0)
With wrkDefault
' Create and append new user.
Set usrNew = .CreateUser(Newuser, Newpid, Newpw)
.Users.Append usrNew
Set grpMember = usrNew.CreateGroup(Newgroup)
usrNew.Groups.Append grpMember
End With
Me!GroupUserInfo = GrpUsrInfo
usrNew.Groups.Refresh
GroupX
Exit_Command1_Click:
Exit Sub
Command1_Click_Err:
MsgBox Err.Number & Err.Description
Resume Exit_Command1_Click
End Sub
Stapes
I have set up my database with a workgroup, groups & users, and have
successfully made a form that allows certain users to add users,
delete users or add a user to a group, display all the Group / User
info or all the Permissions in the Containers collection. But can I
assign permissions to access forms and tables in code?
This is how I add a user: -
Private Sub Command1_Click()
On Error GoTo Command1_Click_Err
' Add User
MsgBox Newuser & "," & Newgroup & "," & Newpid & "," & Newpw & vbCrLf
& _
"Caution: The new Group / User will not appear in the Group / User
window" & vbCrLf & _
" until you close" & _
" the database & re-open it"
Dim wrkDefault As Workspace
Dim usrNew As User
Dim usrLoop As User
Dim grpNew As Group
Dim grpLoop As Group
Dim grpMember As Group
Dim GrpUsrInfo As String
GrpUsrInfo = ""
Set wrkDefault = DBEngine.Workspaces(0)
With wrkDefault
' Create and append new user.
Set usrNew = .CreateUser(Newuser, Newpid, Newpw)
.Users.Append usrNew
Set grpMember = usrNew.CreateGroup(Newgroup)
usrNew.Groups.Append grpMember
End With
Me!GroupUserInfo = GrpUsrInfo
usrNew.Groups.Refresh
GroupX
Exit_Command1_Click:
Exit Sub
Command1_Click_Err:
MsgBox Err.Number & Err.Description
Resume Exit_Command1_Click
End Sub
Stapes