Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting permissions through VBA

Status
Not open for further replies.

tdfreeman

MIS
Mar 28, 2002
85
US
Does anyone know anything about the setpermissions property in Access or anything else that will help my co-worker?

I have a co-worker who has a procedure where he deletes and recreates a table. When he deletes the table the permissions that go with that table are removed. When he recreates the table there are no permissions set on the table. He is using a workgroup information file to keep security. Does anyone know how to dynamically, through VBA, reset permissions?

Thank you for your help.

Tammy
 
I submitted this last night and there is no response yet so I am replying to the thread to get it to the top of the list to see if I can get a response.

Thanks.

Thank you for your help.

Tammy
 
Saw this posting just now. Since nobody replied

Why don't you just change the property for New Tables/Queries to the required permission for the user which creates the table?
the menu is

Tools->Security->User and Group Permissions->

Object type - tables
Select proper UserName and New Tables/Queries

Best of Luck
 
Chanced upon this example from MSDN DAO User

If it is of any help


Sub NewTablesUser()
Dim wsp As Workspace, dbs As Database
Dim usr As User, grp As Group, usrMember As User
Dim ctr As Container, doc As Document

' Return reference to default workspace.
Set wsp = DBEngine.Workspaces(0)
' Return reference to current database.
Set dbs = CurrentDb
' Create User object and append to Users collection
' of Workspace object.
Set usr = wsp.CreateUser("Chris Jones", _
"123abc456DEF", "Password")
wsp.Users.Append usr
' Create Group object and append to Groups
' collection of Workspace object.
Set grp = wsp.CreateGroup("Marketing", "321xyz654EFD")
wsp.Groups.Append grp
' Append new User object to Users collection of
' new Group object.
Set usrMember = grp.CreateUser("Chris Jones")
grp.Users.Append usrMember
' Refresh Users collection of Group object.
grp.Users.Refresh
' Return Container object.
Set ctr = dbs.Containers!Tables
' Set UserName property of Container object.
ctr.UserName = usrMember.Name
' Add retrieve permissions for new user on all tables.
ctr.Permissions = ctr.Permissions Or dbSecRetrieveData
Set dbs = Nothing
Set wsp = Nothing
End Sub


Best of Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top