Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Thu Oct 16 08:53:30 CDT 2003
I still haven't done this inseting of .csv in access table (had other things to do first)Those 2 lines still dont work strSQL = "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & "," & aRecord(8) & ")" con.Execute (strSQL) whats wrong here ? When I run similar message from query window it works fine. This way I get "Operation is not allowed when the object is closed" error. # 3704 (the first part works more or less correctly) 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 'strline = aRecord = Split(strLine, ",") aRecord(8) = Mid(aRecord(8), 5) & Left(aRecord(8), 4) Debug.Print aRecord(6) & " " & aRecord(7) & " " & aRecord(8) strSQL = "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & "," & 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