Importing the txt File and adding file name

dimitri

Registered User.
Local time
Today, 01:24
Joined
Oct 9, 2012
Messages
18
Hello,

I have multiple text files for which the import works fine. I am able to read the contents and insert data into the access database.

My question is, if I need to maintain the file name in the same table as the imported data, how can I achieve this.

So, FileA has 5 columns, 10 rows, the data is read and inserted into Table X, Also table X needs to have the file name in the 6th column for all these rows.

I am using DoCmd.TransferText acImportFixed, "My Specs", "Table X", "MyFile.txt", true


Your help is much appreicated.
 
Adding to the above post, I am able to get the FileName
 
One way would be to run an update query right after the import, updating any records with nothing in the file name field. Done from the beginning, that would mean only the just-imported records would be updated. Another would be to import into a temp table, then run an append query to copy them to the main table, including the new field.
 
No problem, and welcome to the site by the way!
 

Users who are viewing this thread

Back
Top Bottom