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

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
 
K

Klatuu

Dim Ldb As DAO.Database

Set Ldb = DBEngine.OpenDatabase(strRealProContract, _
False, False, ";pwd=YourDatabasePasswordHere")
 
K

Klatuu

Sorry, I answered before I read the entire post.

You will see no UI of any kind when you open an external database. You
have to manipulate the external database's objects programmatically.
 
G

Georges

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
'============================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top