<P>hmmmm, don't know what to suggest unless you use DAO then</P>
<P>Dim db as DAO.Database</P>
<P>Set db = CurrentDB</P>
<P>db.Execute(strSql)</P>
<P>Paul<BR><BR><BR><BR></P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #ff0000 2px solid">Message date : Oct 16 2003, 04:13 PM <BR>From : Oleg_123@xuppa.com <BR>To : accessd@databaseadvisors.com <BR>Copy to : <BR>Subject : Re: Re: [AccessD] still struggling with inserting to access table <BR>I do not have CurrentProject available (i am Access 97, i put reference on <BR>Object 2.5 Lirary) I've selected CurrentDB.Connection, but get the error <BR>message -- <BR>Operation not supported for this type of object <BR><BR>> try adding this line after <BR>> Dim con As New ADODB.Connection <BR>> Set con = CurrentProject.Connection <BR>> This tells it to use the current database. <BR>> Paul <BR>> <BR>> <BR>> <BR>> <BR>> Message date : Oct 16 2003, 03:34 PM <BR>>>From : Oleg_123@xuppa.com <BR>> To : accessd@databaseadvisors.com <BR>> Copy to : <BR>> Subject : Re: [AccessD] still struggling with inserting to access table <BR>> I thought I was using the default connection ? <BR>> <BR>> Also I tried it using this <BR>> DoCmd.RunSQL "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & ", <BR>> " & aRecord(8) & ")" <BR>> <BR>> but I get some pitiful results :( <BR>> <BR>>> As far as I can see you haven't setup a connection into the database <BR>>> for the con variable, so it would be closed when you try the command <BR>>> con.execute. Paul <BR>>> <BR>>> <BR>>> <BR>>> <BR>>> Message date : Oct 16 2003, 02:59 PM <BR>>>>From : Oleg_123@xuppa.com <BR>>> To : accessd@databaseadvisors.com <BR>>> Copy to : <BR>>> Subject : [AccessD] still struggling with inserting to access table I <BR>>> still haven't done this inseting of .csv in access table (had other <BR>>> things to do first)Those 2 lines still dont work <BR>>> strSQL = "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & "," <BR>>> & aRecord(8) & ")" <BR>>> con.Execute (strSQL) <BR>>> <BR>>> whats wrong here ? When I run similar message from query window it <BR>>> works fine. This way I get "Operation is not allowed when the object <BR>>> is closed" error. # 3704 (the first part works more or less <BR>>> correctly) <BR>>> <BR>>> Dim fs As New Scripting.FileSystemObject <BR>>> Dim ts As Scripting.TextStream <BR>>> Dim strLine As String <BR>>> Dim aRecord <BR>>> Dim strSQL As String <BR>>> Dim con As New ADODB.Connection <BR>>> <BR>>> If fs.FileExists("U:\Users\HRIS\oleg\cars testing\trainFROM.csv") Then <BR>>> <BR>>> <BR>>> Set ts = fs.OpenTextFile("U:\Users\HRIS\oleg\cars <BR>>> testing\trainFROM.csv", ForReading) <BR>>> <BR>>> Do Until ts.AtEndOfStream <BR>>> <BR>>> strLine = ts.ReadLine <BR>>> 'strline = <BR>>> aRecord = Split(strLine, ",") <BR>>> aRecord(8) = Mid(aRecord(8), 5) & Left(aRecord(8), 4) <BR>>> Debug.Print aRecord(6) & " " & aRecord(7) & " " & aRecord(8) <BR>>> <BR>>> strSQL = "INSERT into Table1Testing(a,b) Values(" & aRecord(0) & "," <BR>>> & aRecord(8) & ")" <BR>>> con.Execute (strSQL) <BR>>> <BR>>> Loop <BR>>> Else <BR>>> MsgBox ("file doesn't exist") <BR>>> End If <BR>>> <BR>>> <BR>>> <BR>>> ----------------------------------------- <BR>>> Get Breaking News from CNN, ABC, NBC, CBS Now. <BR>>> http://www.xuppa.com/news/?link=webmail <BR>>> <BR>>> <BR>>> _______________________________________________ <BR>>> AccessD mailing list <BR>>> AccessD@databaseadvisors.com <BR>>> http://databaseadvisors.com/mailman/listinfo/accessd <BR>>> Website: http://www.databaseadvisors.com <BR>> <BR>> <BR>> <BR>> ----------------------------------------- <BR>> Get Breaking News from CNN, ABC, NBC, CBS Now. <BR>> http://www.xuppa.com/news/?link=webmail <BR>> <BR>> <BR>> _______________________________________________ <BR>> AccessD mailing list <BR>> AccessD@databaseadvisors.com <BR>> http://databaseadvisors.com/mailman/listinfo/accessd <BR>> Website: http://www.databaseadvisors.com <BR><BR><BR><BR>----------------------------------------- <BR>Get Breaking News from CNN, ABC, NBC, CBS Now. <BR>http://www.xuppa.com/news/?link=webmail <BR><BR><BR>_______________________________________________ <BR>AccessD mailing list <BR>AccessD@databaseadvisors.com <BR>http://databaseadvisors.com/mailman/listinfo/accessd <BR>Website: http://www.databaseadvisors.com <BR></BLOCKQUOTE>