Question : Remove security from MS Access Database (Jet Engine)

I accidentally deployed an Access database to my users with my own User ID, Password and Database Password in it.  This database consists of a journal where they enter their own data.  In my next version of the software, coming out very soon, I need to completely remove any security from the file so that if they have MS-Access on their computer, they can view the file.

How do I check, upon start, if the journal database has security in it, and if so, remove all security?

My current connection string is something like this:

        str1 = "Provider = Microsoft.Jet.OLEDB.4.0;"

        str1 &= "User ID = userid;"
        str1 &= "Password = passwd;"

        str1 &= "Jet OLEDB:System database = " & _
            GetCurrentDirectory() & "\Data\System1.mdw;"

        str1 &= "Data Source = " & global_Journal & ";"

        str1 &= "Jet OLEDB:Database Password=DBpasswd;"

Answer : Remove security from MS Access Database (Jet Engine)

Assuming you've properly secured the database, that won't be the case. If you've properly secured the database and they attempt to open it with a different workgroup (like thier own System.mdw file) then they will get the "You don't have the permission blah blah" error message.

User Level Security consists of a Workgroup file and the Database file. The Workgroup contains Users, Groups, User+Group associations, and Passwords. A single workgroup can be used to secure many different databases. The database file itself contains the object permissions - all the workgroup really does is authenticate the user, and then pass a SID to the database, which that db then uses when determining the actions a user may take. ULS is also "session-based" - that is, I can have multiple "sessions" of Access open on my machine, each using a different workgroup file. If I have SessionA opened with WorkgroupA, and I attempt to open a database in that session that was NOT secured with WorkgroupA, then I get an error message (assuming, of course, that the database is properly secured).

In order to open a properly secured database, you MUST use the workgroup file that was used to originally secure the database. To do that, you have two choices: either join the machine to that workgroup (NOT a good idea), or use a shortcut as described above to open a session of Access with that workgroup. By far, the better idea is to use a shortcut to open a session of Access.

As to the DB password - I didn't see that, since it highly unusual to have both ULS and a database password - then once you open the database you can use DAO to change that password:

CurrentDB.NewPassword "old pw", "new pw"

Of course this is a DAO method, not an ADO method. To do that, you must use an ALTER SQL statement. See this KB article:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q304915
Random Solutions  
 
programming4us programming4us