Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Thu Oct 16 09:31:19 CDT 2003
I thought I was using the default connection ? Also I tried it using this DoCmd.RunSQL "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & ", " & aRecord(8) & ")" but I get some pitiful results :( > As far as I can see you haven't setup a connection into the database for > the con variable, so it would be closed when you try the command > con.execute. Paul > > > > > Message date : Oct 16 2003, 02:59 PM >>From : Oleg_123 at xuppa.com > To : accessd at databaseadvisors.com > Copy to : > Subject : [AccessD] still struggling with inserting to access table 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 > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com ----------------------------------------- Get Breaking News from CNN, ABC, NBC, CBS Now. http://www.xuppa.com/news/?link=webmail