A
Adam
I am trying to secure an Access 2000 database through VBA code.
When I first secure the database, I set permissions for the various existing
tables, and everything seems to work just fine. The trouble is setting
permissions for new tables. I would like one user group to have permissions
to create and modify the design of new tables. I believe (and perhaps I am
wrong here) that the way to do that is to set permissions on the tables
container object with code such as the following:
Set Con = db.Containers("Tables")
Con.UserName = "SuperUsers"
Con.Permissions = dbSecFullAccess
Now, when I do this, a member of my SuperUsers group can indeed create a
table, and even modify its design, delete it, etc. The same member can even
set permissions on the new table for other users. However, when I try to set
permissions on the table through code, it doesn't work. The distressing
thing is I don't even get an error message: the code just stops running when
it gets to the bit when it trys to set the security on the new table.
Specifically, I set a Document object to the table with code such as:
Set Doc = db.Containers("Tables").Documents("NewTable")
and then try to set the security with the line
Doc.UserName = "Admins"
Doc.Permissions = dbSecNoAccss Or dbSecRetrieveData
The first of those lines doesn't run at all: the code just stops when it
gets there.
Does anyone have any idea what is happening here?
Many thanks
When I first secure the database, I set permissions for the various existing
tables, and everything seems to work just fine. The trouble is setting
permissions for new tables. I would like one user group to have permissions
to create and modify the design of new tables. I believe (and perhaps I am
wrong here) that the way to do that is to set permissions on the tables
container object with code such as the following:
Set Con = db.Containers("Tables")
Con.UserName = "SuperUsers"
Con.Permissions = dbSecFullAccess
Now, when I do this, a member of my SuperUsers group can indeed create a
table, and even modify its design, delete it, etc. The same member can even
set permissions on the new table for other users. However, when I try to set
permissions on the table through code, it doesn't work. The distressing
thing is I don't even get an error message: the code just stops running when
it gets to the bit when it trys to set the security on the new table.
Specifically, I set a Document object to the table with code such as:
Set Doc = db.Containers("Tables").Documents("NewTable")
and then try to set the security with the line
Doc.UserName = "Admins"
Doc.Permissions = dbSecNoAccss Or dbSecRetrieveData
The first of those lines doesn't run at all: the code just stops when it
gets there.
Does anyone have any idea what is happening here?
Many thanks