Load & display a secured DB without having to type the password

  • Thread starter Thread starter Georges
  • Start date Start date
G

Georges

Hello

Is possible to open a database that is protected by a global password (Tools
Menu, Security, Set Database Password...) programmatically from another
database and without having Access prompt the user to enter the password?

I've tried almost everything... but hope there is still a solution that I
haven't seen

The function OpenDatabase returns a database and it works fine (with a
Microsoft Jet workspace or ODBCDirect).

Set db = DBEngine.Workspaces(0).OpenDatabase("C:\Program Files\Microsoft
Office\Office10\Samples\Northwind.mdb", False, False, "MS
Access;PWD=northwind")

The database is loaded, but there is no Display property or anything to
bring it to the screen..

There is an alternative to this using the Shell command where the
password/userId can be set. But it concerns the user's/group's workspace
password. and this password is not sufficient, since a vicious person can
create a new access file and import all the database objects without having
to enter any password if the 'general' password is not defined.

Thanks for any relevant hint or suggestion!
Best regards
 
Here is the answer to my question found on the MS website
http://support.microsoft.com/kb/235422/
'============================================================
Option Compare Database
Option Explicit

Sub OpenPasswordProtectedDB()
'Définit la valeur Static de façon à ce que l'instance de Microsoft
Access
'ne se ferme pas lorsque la procédure est terminée.
Static acc As Access.Application
Dim db As DAO.Database
Dim strDbName As String
strDbName = "C:\Program Files\Microsoft
Office\Office\Samples\Northwind.mdb"
Set acc = New Access.Application
acc.Visible = True
Set db = acc.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=nwind")
acc.OpenCurrentDatabase strDbName
db.Close
Set db = Nothing
End Sub
'============================================================
 
Back
Top