Transfer table via VBA

FuzMic

DataBase Tinker
Local time
Tomorrow, 07:55
Joined
Sep 13, 2006
Messages
744
Hi gurus

I have a table in a current .mdb and I want to copy/ export/transfer it to another .mdb which is password protected. I am thinking that DoCmd.TransferDatabase may do it but have never tried.

My mental block is how to resolve the password requirement because whenever we export from MDB1 to MDB2, if 2 is password protected it will ask you for the password.

Please give me helping hand.
 
Can you not get the password? It would seem illogical to password a database if it could be circumvented that easily no?
 
Search the net for Access password cracks
 
I assume you know the password, and just want to do it programmatically. It's not clear how to do this from help on the docmd action.

you can include a pwd in an ODBC link, but maybe that isn't so helpful.

maybe MS help has some info?
 
Dave you are most right, i already know the password of the destination .mdb but just want to do it with VBA.

With ODBC key string part may be
ODBC;DSN=DataSource1;UID=User2;PWD=www;LANGUAGE=us_english;" _
& "DATABASE=pubs",
But then is is not ODBC and password relates to the destination .mdb.

Hence do you think if i first open the destination .mdb then export; will do it. I will try this way, if it works i will share it.
 
Here the final solution using sql code that handles also the password; it should quite evident

Currentdb.execute "SELECT * INTO [MS Access; PWD=TargetMdb-PassWord; DATABASE= TargetMdb].[TargetTableName] FROM SourceTableName;"

SourceTableName is a table in currentdb.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom