Copy table between protected databases via VBA

J

JRidenour

I have two Access 2k databases that have database
passwords. Does anyone know how to copy/transfer the a
table (with or without the data) from one protected
database to another using VBA code. I do not want the
user to have to key-in the database passwords.

I'm expecting that it may involve copying the table from
protected database A to the current database, and then
copying the table from the current database to protected
database B.
 
J

John Nurick

Hi,

You can use something like this to open the second database from code
running in the first and then transfer a table:

Dim dbB as DAO.Database

Set dbB = DBEngine.Workspaces(0).OpenDatabase("D:\Folder\File", _
True, True, ";pwd=XXX")
DoCmd.TransferDatabase acImport, "Microsoft Access", _
dbB.Name, acTable, "MyTable", "MyTable"
....
dbB.Close
Set dbB = Nothing
 
J

JRidenour

Thanks ... it works great!

-----Original Message-----
Hi,

You can use something like this to open the second database from code
running in the first and then transfer a table:

Dim dbB as DAO.Database

Set dbB = DBEngine.Workspaces(0).OpenDatabase ("D:\Folder\File", _
True, True, ";pwd=XXX")
DoCmd.TransferDatabase acImport, "Microsoft Access", _
dbB.Name, acTable, "MyTable", "MyTable"
....
dbB.Close
Set dbB = Nothing



I have two Access 2k databases that have database
passwords. Does anyone know how to copy/transfer the a
table (with or without the data) from one protected
database to another using VBA code. I do not want the
user to have to key-in the database passwords.

I'm expecting that it may involve copying the table from
protected database A to the current database, and then
copying the table from the current database to protected
database B.

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 

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