Importing text into a single field of existing database

Copper Contributor

I hate asking this, as I have figured it out before, but cannot remember how I did it.

 

I have a simple Access database table with six fields. The second field is a text field.  I have a text file (*.txt) with multiple lines of text (say 25 titles in 25 lines in the text file). I want to append the 25 titles into the second field of the table. I am pretty sure I was able to do this with the text import wizard and the Advanced button, but the exact set-up escapes me now.

 

Any references as to importing lines of text from a text file into a text field of a multiple field table would be appreciated.

 

 

 

 

2 Replies
Yes you can use the Import Text wizard...with or without the Advanced button depending on your needs. That partly depends on the other fields in your table e.g. do you have an auto number primary key field. Are any of the other fields required?
Or you can link the text file as a linked table then run an append query.
Or you can do this in code using DoCmd.TransferText

SOLUTION

 

1) the first line of text in the text file should be the same as the field title that you want to insert the data into. For example, if you are appending new records by inserting lines of text into the TITLE field, then the first line in the text file should be TITLE.

2) Start the text insert wizard.

3) Chose "delimited" for the input type.

4) Click on the check box that says the first line in the file contains the name of the field you want the text to be inserted into.

5) The deliminator type was automatically chosen to be a comma; this made no difference for me as the text records being imported are filenames, which do not contain commas.

6) Hit finish, and new records with the text in the appropriate field are added to the table.