[AccessD] converting csv to table (almost done)

Oleg_123 at xuppa.com Oleg_123 at xuppa.com
Tue Oct 14 15:52:21 CDT 2003


ok, thanks to Marty. 80% of it works as it worked yesterday on Access2000.
Now I just need to insert to access table, and from there, I'll know how
to take it.
 strSQL = "INSERT into Table1Testing(" & aRecord(0) & "," & aRecord(1) &
"," & aRecord(2) & "," & aRecord(3) & "," & aRecord(4) & "," & aRecord(5)
& "," & aRecord(6) & "," & aRecord(7) & "," & aRecord(7) & "," &
aRecord(8) & ")"
    con.Execute (strSQL)

This is not doing giving some enigmatic error message about "Operation not
allowed when the object is closed"


    Dim fs As New Scripting.FileSystemObject
    Dim ts As Scripting.TextStream
    Dim strLine As String
    Dim aRecord
    Dim strSQL As String
    Dim con As New ADODB.Connection

    If fs.FileExists("U:\Users\HRIS\oleg\cars testing\trainFROM.csv") Then

    Set ts = fs.OpenTextFile("U:\Users\HRIS\oleg\cars
testing\trainFROM.csv", ForReading)

    Do Until ts.AtEndOfStream
       strLine = ts.ReadLine
    'Debug.Print strLine
    aRecord = Split(strLine, ",")
    aRecord(8) = Mid(aRecord(8), 5) & Left(aRecord(8), 4)
    Debug.Print aRecord(8)

     strSQL = "INSERT into Table1Testing(" & aRecord(0) & "," & aRecord(1)
& "," & aRecord(2) & "," & aRecord(3) & "," & aRecord(4) & "," &
aRecord(5) & "," & aRecord(6) & "," & aRecord(7) & "," & aRecord(7) &
"," & aRecord(8) & ")"
    con.Execute (strSQL)
    Loop
    Else
     MsgBox ("file doesn't exist")
    End If



-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail




More information about the AccessD mailing list