Hi:
I have a text file that looks something like this:
0195393417 Jan 31 2004 12:24:03PM Z
0195393808 Jan 31 2004 12:34:11PM Z
I need to import this text file into a table using either fso or csv. I do not know how to start this project. Please Help
Thanks
' Me.txtInputFileName = Ctrl on Form representing File\Loc
' Me.txtNoOfFields = Ctrl on Form representing # of fields
' rst, Recordset variable ought to match the Input file
Dim rst as Recordset
Dim i as Integer
Dim tTextFile as String
Dim tArray()
Set rst = CurrentDb().OpenRecordset("tbl_SomeTable"
Close #1 ' just in-case it was opened
Open Me.txtInputFileName For Input As #1
ReDim tArray(Me.txtNoOfFields)
Do While Not EOF(1)
Line Input #1, tTextFile
tArray = Split(tTextFile,Chr$(9)) ' if a Tab-delimiter
rst.AddNew
For i = 0 To Me.txtNoOfFields - 1
rst(i) = tArray(i)
Next
rst.Update
Loop
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.