TransferDatabase aclink on a password protected database

G

Guest

I want to link a table from a password protected database (DbB) to my current database (DbA). I am trying to use the DoCmd.TransferDatabase method, but I haven't got any success

The sintaxis I am using is
DoCmd.TransferDatabase acLink "Microsoft Access", "c:\DbsB.mdb", acTable, "TT_ExportMovs", "TT_ExportMovsA", False, Tru

or
DoCmd.TransferDatabase TRANSFERTYPE:=acLink, DATABASETYPE:= "Microsoft Access", DATABASENAME:= "C:\DbsB.mdb", OBJECTYPE:=acTable, Source:= "TT_ExportMovs", Destination:="TT_ExportMovsA", STRUCTUREONLY:=False, STORELOGIN:=Tru

However, where should I indicate that the password to open DbsB, is "PACO".
If I use this sintaxis I get prompted for the password, and I want it to be kept in the linking code
Any help would be greatly appreciated
Francisco
 
W

Wayne Morgan

Here is an example where I am doing that while creating a new database file.

Set wrkDefault = DBEngine.Workspaces(0)
Set dbsNew = wrkDefault.CreateDatabase("A:\MyDatabase.mdb", _
dbLangGeneral & ";pwd=password", dbVersion30)
'Export the needed tables and queries
DoCmd.TransferDatabase acExport, "Microsoft Access", "" & dbsNew.Name & "",
acTable, "D10db", "D10db", , True
DoCmd.TransferDatabase acExport, "Microsoft Access", "" & dbsNew.Name & "",
acTable, "tblTeam", "tblTeam", , True
'etc

You can probably do the same thing using OpenDatabase instead of
CreateDatabase to transfer the object to an existing database.


--
Wayne Morgan
MS Access MVP


Francisco said:
I want to link a table from a password protected database (DbB) to my
current database (DbA). I am trying to use the DoCmd.TransferDatabase
method, but I haven't got any success:
The sintaxis I am using is:
DoCmd.TransferDatabase acLink "Microsoft Access", "c:\DbsB.mdb", acTable,
"TT_ExportMovs", "TT_ExportMovsA", False, True
or:
DoCmd.TransferDatabase TRANSFERTYPE:=acLink, DATABASETYPE:= "Microsoft
Access", DATABASENAME:= "C:\DbsB.mdb", OBJECTYPE:=acTable, Source:=
"TT_ExportMovs", Destination:="TT_ExportMovsA", STRUCTUREONLY:=False,
STORELOGIN:=True
 
L

Lynn Trapp

I don't believe there is anyway to do it if you are referring to a database
password. If you are using User Level security, then you can use the
User="UserName" and Pwd = "Password" parameters.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


Francisco said:
I want to link a table from a password protected database (DbB) to my
current database (DbA). I am trying to use the DoCmd.TransferDatabase
method, but I haven't got any success:
The sintaxis I am using is:
DoCmd.TransferDatabase acLink "Microsoft Access", "c:\DbsB.mdb", acTable,
"TT_ExportMovs", "TT_ExportMovsA", False, True
or:
DoCmd.TransferDatabase TRANSFERTYPE:=acLink, DATABASETYPE:= "Microsoft
Access", DATABASENAME:= "C:\DbsB.mdb", OBJECTYPE:=acTable, Source:=
"TT_ExportMovs", Destination:="TT_ExportMovsA", STRUCTUREONLY:=False,
STORELOGIN:=True
 

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