Access to Access ODBC Connection

Access to Access ODBC Connection

Post by szymon_ » Fri, 31 Mar 2006 20:16:48


How to connect one MS Access database to another password protected
(database password) database so that to have an access to the tables
only from VBA. I don't want them to be linked and visible in the
database, but i would like to get data from this external tables only
from the code.
Szymon.
 
 
 

Access to Access ODBC Connection

Post by QW5kcmV3IF » Fri, 31 Mar 2006 23:22:03

It's been a while, but try the following.

...
Dim strDatabase as String
Dim strPassword as String

Dim dbData As DAO.Database
Dim ws As DAO.Workspace

strDatabase = "c:\my folder\database.mdb"
strPassword = "MyPassword"

Set ws = DBEngine.Workspaces(0)
Set dbData = ws.OpenDatabase(strDatabase, , , ";Pwd=" & strPassword)
...

Hope this helps.

 
 
 

Access to Access ODBC Connection

Post by szymon_ » Sat, 01 Apr 2006 00:44:18

Thank's
It should work, but I get "Invalid Password" error...
 
 
 

Access to Access ODBC Connection

Post by QW5kcmV3IF » Sat, 01 Apr 2006 01:15:02

Try it with:

Set dbData = ws.OpenDatabase(strDatabase, True, False, ";PWD=" & strPassword)