Page 1 of 1

user level security for access database

PostPosted: July 12th, 2011, 3:16 pm
by emad
Hi.
I have an access database protected by user level security. I mean it has user name and password .
I created my database with access 2007(access 2000 file format) and connected to it by code successfully(by means of my security.mdw).
now i want to create my database by code.I use ADOX to create my database,but although I've assigned permissions to my tables but they opens by unauthorized users.anyone knows how can I protect may database by code in the user level.I emphasis when I create my database using access it works fine.
thanks a lot.

Re: user level security for access database

PostPosted: July 13th, 2011, 6:20 am
by emad
Hi.
I think I found the problem but i cant solve it.
problem is granting or revoking permissions to database object itself.
I use code like this:
Catalog1.Users['Admin'].SetPermissions('',adPermObjDatabase,adAccessRevoke, adRightMaximumAllowed,adInheritNone,Unassigned);
but it raise exception "Object is invalid or unknown to the provider."
does anyone know why I get this error message?

Re: user level security for access database

PostPosted: July 14th, 2011, 4:51 pm
by emad
HI.
Finally I solved problem myself.
rather using null string we should use null char.
I mean #0 rather than ''.
I wrote this comment to help everyone else that has same problem.

Re: user level security for access database

PostPosted: July 15th, 2011, 12:42 am
by Kambiz
Thanks for sharing the information!