Sub MultiLine_to_Table()
On Error GoTo MultiLine_to_Table_Error
Const cstFileIn As String = "[b][i]Your File name & path here[/i][/b]"
Const cstOutputTable As String = "[b][i]Your 9 field output table name[/i][/b]"
[b]'You will need to make sure you have a reference
'in your project to an ADODB library or change the
'code to use DAO[/b]
Dim rstOut As New ADODB.Recordset
Dim intFileIn As Integer, intLineIn As Integer
Dim strTemp As String
'open the file
intFileIn = FreeFile
Open cstFileIn For Input As #intFileIn
'Open the recordset
rstOut.Open cstOutputTable, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do
'Get the next (or first) line
Line Input #intFileIn, strTemp
'for first field create a new record
If intLineIn = 0 Then
rstOut.AddNew
End If
'write field data and index
rstOut.Fields(intLineIn) = strTemp
intLineIn = intLineIn + 1
'check if record is complete
If intLineIn > 9 Then
'it is so update and reset field index
rstOut.Update
intLineIn = 0
End If
Loop Until EOF(intFileIn)
MultiLine_to_Table_Exit:
Close intFileIn
rstOut.Close
Set rstOut = Nothing
Exit Sub
MultiLine_to_Table_Error:
Debug.Print Now, "MultiLine_to_Table", Err.Number, Err.Description
Stop
Resume MultiLine_to_Table_Exit
End Sub