Permissions on table object

R

RipperT

I created a form for a select few people to create basic (throwaway) user
accounts. The code creates a user, adds it to the default users group, a
custom "LineStaff" group, and optionally a "NotherGroup". If I log on using
any account but my Administrator account, the following error is generated:

You do not have the necessary permissions to use the 'Tables' object. Have
your system administrator or the person who created this object establish
the appropriate permissions for you.

Not sure what the Tables object is. Why is it involved here when the code
doesn't refer to any tables? Many thanks to any who can enlighten me.

Private Sub cmdCreateUser_Click()
On Error GoTo Err_cmdCreateUser_Click

Dim wrkDefault As Workspace
Dim usrNew As User
Dim usrTemp As User
Dim strUserName As String

Set wrkDefault = DBEngine.Workspaces(0)

With wrkDefault

'Create and append new User.
strUserName = Me.txtUserName

Set usrNew = .CreateUser(strUserName)
usrNew.PID = "1234"
.Users.Append usrNew

Set usrTemp = .Groups("Users").CreateUser(strUserName)
.Groups("Users").Users.Append usrTemp
Set usrTemp = .Groups("Users").CreateUser(strUserName)
.Groups("LineStaff").Users.Append usrTemp

If Me.chkMyCheckbox = True Then
Set usrTemp = .Groups("Users").CreateUser(strUserName)
.Groups("NotherGroup").Users.Append usrTemp
End If

MsgBox "User created successfully. ", vbExclamation, "Success!"
Me.txtUserName = ""
Me.chkControlCenter = False
Set usrTemp = Nothing

End With

Exit_cmdCreateUser_Click:
Exit Sub

Err_cmdCreateUser_Click:
MsgBox Err.Description
Resume Exit_cmdCreateUser_Click

End Sub
 
J

Joan Wild

A user needs to be a member of the Admins Group in order to create user
accounts. Sounds like they aren't a member.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top