Import File

I

Ivan Jaramillo

I'm using DoCmd.TransferText to import a txt file into a
access table. My question is: how can I import the txt
file in a table that is located in a different DB of the
current DB????

Thanks for you help
 
J

John Nurick

Hi Ivan,

If the table already exists in the other database:
1) create a linked table to connect to it (File|Get External Data|Link).
2) specify the name of the linked table when you call
DoCmd.TransferText.

Otherwise, the alternatives include
A) Create the table in the other database and proceed as above
B) Instead of TransferText, create and execute a query using syntax ike
this to specify the textfile and destination database:

SELECT * INTO NewTable IN "D:\Folder\OtherDatabase.mdb"
FROM [Text;HDR=Yes;Database=D:\TextFileFolder\;].Filename#txt;
 
Top