On Thu, 24 May 2007 06:27:00 -0700, Peter Karlström
wrote:
¤ Hi
¤
¤ How do I use DAO to open an Access (2002) database which has a password?
¤
¤ The goal is to copy tables (with structure and data) from one Access
¤ database to another.
¤ So any other solution is appreciated.
If you open the source database you can copy to a destination database using something like the
following (assumes existing database and table):
INSERT INTO [MS Access;DATABASE=c:\Test Files\db1.mdb;PWD=password].[Data] SELECT * FROM [Data]
You can build the structure at the same time as you export the data using something like:
SELECT * INTO ... FROM ...
The above method will not generate the primary key or any indexes so you will have to add those
using extra DAO code.
Paul
~~~~
Microsoft MVP (Visual Basic)
>> Stay informed about: OpenDatabase for Access database with password