I'm curious why? Even a system administrator shouldn't have a reason to do that. Assuming it's possible, it would require code like the following. I'm logging on to Test.mdb with administrator priviledges, and running a procedure in Test.mdb that gives the 'NewUser' account permission to delete records from Table1.
Sub ModifyNewUserPermissions()
Dim db As DAO.Database
Dim wks As DAO.Workspace
Dim doc As DAO.Document
' Reference the shared workgroup file.
DBEngine.SystemDB = "C:\Temp\TestSystem.mdw"
Set wks = DBEngine.CreateWorkspace("", "Bob Bedell", "password")
Set db = wks.OpenDatabase("C:\Temp\Test.mdb")
Set doc = db.Containers("Tables").Documents("Table1")
doc.UserName = "NewUser"
doc.Permissions = dbSecDeleteData
End Sub
See the Permissions enum for other 'dbSec' settings. The only table permission options available through code, however, are to read, edit, and delete table definitions, or read, edit and delete records from tables. Even users with read-only priviledges already have read access to the MSysObjects table which you might want to query from time to time (to get lists of objects in the database), but there is nothing in any of the other system tables that users (or administrators for that matter) should get anywhere near.
Regards,
Bob
|