Copy table between protected databases via VBA

  • Thread starter Thread starter JRidenour
  • Start date Start date
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.
 
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
 
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.
.
 
Back
Top