[AccessD] Opening password protected database

MartyConnelly martyconnelly at shaw.ca
Fri Jul 14 12:30:40 CDT 2006


You need a colon to dummy out first database type parameter in syntax

Set myDatabase = DBEngine.OpenDatabase(mydbPath, False, False, ";pwd=abc")

examples

Set myDatabase = DBEngine.OpenDatabase(mydbPath, False, False, " FoxPro 
2.5;pwd=abc")
or

Set myDatabase = DBEngine.OpenDatabase(mydbPath, False, False, "MS 
Access;pwd=abc")

 However in the DAO  documentation, that in case of Microsoft Jet one 
shouldn't specify the
database type.  Look it up in

C:\Program Files\Common Files\Microsoft Shared\DAO\DAO35.HLP


Rocky Smolin - Beach Access Software wrote:

>Dear List:
>
>I am trying to open a password protected database using the following:
>
>Set db = CurrentDb
>MsgBox db.Name
>Dim strPWD As String
>strPWD = "shannon"
>Dim strDB As String
>strDB = Left(db.Name, Len(db.Name) - 6) & "BE.mdb"
>Set db = DBEngine.OpenDatabase(strDB, False, False, "pwd=" & strPWD)
>
>
>Set db = DBEngine.OpenDatabase(db.Name, False, False, "pwd=" & strPWD)
>
>I used Set db = CurrentDb just to be sure I was getting the exact path 
>and file name of the back end and strDB does indeed have the correct 
>path and filename of the back end.  The password is also correct.
>
>What am I doing wrong?
>
>Maybe there's a simpler way? The client wants to have the back end 
>password protected, so instead of using the simple set db=Currentdb 
>everywhere in the app I guess I have to use some syntax which specifies 
>the password.  All the tables in the back end are linked.
>
>MTIA
>
>Rocky
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada




More information about the AccessD mailing list