OpenDatabase method with password

  • Thread starter Thread starter Yanto
  • Start date Start date
Y

Yanto

I like to open other Access Database (protected by password) from current
Access database.
How to do this using code (opendatabase method)?
for example the other database is "test.mdb", the pasword is "aaa"
TIA


Yanto
 
Yanto said:
I like to open other Access Database (protected by password) from current
Access database.
How to do this using code (opendatabase method)?
for example the other database is "test.mdb", the pasword is "aaa"

Dim dbs As DAO.Database

Set dbs = OpenDatabase("test.mdb", True, False, ";PWD=aaa")

You'll probably need a path in front of "test.mdb". You can
check the on-line help for proper syntax of the OpenDatabase() call.
 
John Mishefske said:
Dim dbs As DAO.Database

Set dbs = OpenDatabase("test.mdb", True, False, ";PWD=aaa")

You'll probably need a path in front of "test.mdb". You can
check the on-line help for proper syntax of the OpenDatabase() call.

John's right that you should read Help for the syntax, but I thought I'd
point out that the True opens the database exclusively (use False if you
want it to not be opened exclusively), and the False means that the database
will not be read-only (use True if you want read-only)

While the Help file indicates that these parameters are optional, you MUST
include them if you want the password to be recognized.
 
Back
Top