This sample shows u how u should open and read the file:
VB Code:
Option Explicit Private Sub Command1_Click() Dim arrData() As String Dim s As String Dim i As Integer Open "c:\c1_1801t113036_testinga45minuterun.txt" For Input As #1 Do While Not EOF(1) Line Input #1, s arrData = Split(s, ",") For i = 0 To UBound(arrData) Debug.Print arrData(i) Next i Loop Close #1 End Sub
Try the sample in a new project. step throug it and observe.
Now, in order to import the data u would have to put in some more code
eg:
VB Code:
Option Explicit Private Sub Command1_Click() Dim arrData() As String Dim s As String Dim i As Integer Open "c:\c1_1801t113036_testinga45minuterun.txt" For Input As #1 Do While Not EOF(1) Line Input #1, s arrData = Split(s, ",") 'For each line u will add a new record to the table. 'do this here. For i = 0 To UBound(arrData) 'instead of debug.print, u should add the values to the 'correct fields in the record. do that here. Debug.Print arrData(i) Next i 'When u get here, a new record has been added. Update it 'so it is saved. Loop Close #1 End Sub
Hope this is of help to u.![]()





Reply With Quote