Import txt file with different number of columns than table (1 Viewer)

griffins69

griffins69
Local time
Today, 01:20
Joined
Apr 15, 2010
Messages
18
I'm trying to import a txt file with 24 columns into a table with 25 columns. Then I would like to update the one empty column with a string 3 characters long.

I will be importing 5 different files into this table and I will need to update that blank column with 5 different 3 character strings.

I currently use "Docmd" below, but now that I added a column I assume I need another method.

DoCmd.TransferText acImportDelim, Import_Specs, tableName, FileName, True
 

jdraw

Super Moderator
Staff member
Local time
Today, 01:20
Joined
Jan 23, 2006
Messages
15,379
I'm trying to import a txt file with 24 columns into a table with 25 columns. Then I would like to update the one empty column with a string 3 characters long.

I will be importing 5 different files into this table and I will need to update that blank column with 5 different 3 character strings.

I currently use "Docmd" below, but now that I added a column I assume I need another method.

DoCmd.TransferText acImportDelim, Import_Specs, tableName, FileName, True

An approach:

Import the data into a 24 column table.
Add the new column (#25)
Update the new column with your 3 char fld where the first column is not null.
Import the second file to a known table (same table as before)
Update your 3char column with new query where 3char column is NULL.
 

griffins69

griffins69
Local time
Today, 01:20
Joined
Apr 15, 2010
Messages
18
I will be importing the data into the same table all the time. The first time it works, but I get an error once I try importing into the table with 25 columns.
 

griffins69

griffins69
Local time
Today, 01:20
Joined
Apr 15, 2010
Messages
18
I think my error is one file I'm bringing in......I will play with the file
I will update the file as I bring them in.

Thanks
 

Users who are viewing this thread

Top Bottom