There are several ways of doing it. One is to build and execute the SQL
statement for a query that unions each of the 10 fields in the text file
into a single column and appends it to a table in your database. Here's
what the query looks like in my test system, where the table is called
Nathan, its single field is called XXX, and we're importing from the
file C:\Temp\Nathan\n1.csv:
INSERT INTO Nathan (XXX) SELECT XXX FROM
(
SELECT F1 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan\;].N1#csv
UNION
SELECT F2 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F3 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F4 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F5 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F6 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F7 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F8 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F9 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
UNION
SELECT F10 AS XXX FROM [Text;HDR=No;Database=C:\TEMP\Nathan;].N1#csv
);
The code to import data from a single file would be something like this
(untested air code). I'll leave it to you to split the FileSpec argument
(e.g. C:\Temp\Nathan\N1.csv) into strFolder, strFileName and strFileExt,
using VBA functions such as InStr(), Left() and Mid(), and of course
you'll need to substitute your actual table and field names.
Sub ImportOneFile(FileSpec As String)
Dim strSQL As String
Dim strFolder As String
Dim strFileName As String
Dim strFileExt As String
Dim strSub As String
Dim strFROM As String
Dim j as Long
'start of SQL statement
strSQL = "INSERT INTO Nathan (XXX) SELECT XXX FROM (" & vbCrLf
'*** Replace this with code to split up FileSpec ***
strFolder = "C:\Temp\Nathan\"
strFileName = "N1"
strFileExt = "csv"
'Assemble parts of file spec into FROM clause ready for use
strFROM = " AS XXX FROM [Text;HDR=No;Database=" _
& strFolder & ";]." & strFileName & "#" & strFileExt _
& vbCrLf
For j = 1 to 10
If j = 0 Then
strSub = ""
Else
strSub = "UNION" & vbCrLf
End If
strSub = strSub & " SELECT F" & CStr(j) & strFROM
strSQL = strSQL & strSub
Next j
strSQL = strSQL & ");"
CurrentDb.Execute strSQL, dbFailOnError
End Sub
I forgot to mention, I don't have perl, sed, or awk on my machine.