paul.hartland at fsmail.net
paul.hartland at fsmail.net
Thu Oct 16 09:06:15 CDT 2003
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20031016/f5058f3e/attachment-0001.html>