Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Tue Oct 21 09:38:00 CDT 2003
I still get byRef argument type mismatch :((
What does it mean ?
------
Private Sub Command14_Click()
MsgBox ("hey")
Dim fs As New Scripting.FileSystemObject
Dim ts As Scripting.TextStream
Dim strLine As String
Dim aRecord
Dim strSQL As String
Dim db As DAO.Database
Dim i As Integer
Set db = CurrentDb
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 = Replace(strLine, """, " ") 'need to replace " with space
strLine = Replace(strLine, ",", vbTab)
aRecord = Split(strLine, vbTab)
aRecord(8) = Mid(aRecord(8), 5) & Left(aRecord(8), 4)
'strSQL = "INSERT into Table1Testing(a, b, c,d,e) Values(" & "'" &
aRecord(0) & "','" & aRecord(1) & "','" & Replace01(aRecord(2),
"'", "''") & "','" & Replace01(aRecord(3), "'", "''") & "','" &
Replace01(aRecord(4), "'", "''") & "')"
strSQL = "INSERT into Table1Testing(a, b, c,d,e) Values(" & "'" &
aRecord(0) & "','" & aRecord(1) & "','" & Replace(aRecord(2),
Chr(39), Chr(39) + Chr(39)) & "','" & Replace(aRecord(3), Chr(39),
Chr(39) + Chr(39)) & "','" & Replace(aRecord(4), Chr(39), Chr(39) +
Chr(39)) & "')"
Debug.Print strSQL
CurrentDb.Execute (strSQL)
Loop
Else
MsgBox ("file doesn't exist")
End If
MsgBox ("end")
End Sub
> Hi Oleg
>
> Try this:
>
> Replace(MyRecord(0), Chr(39), Chr(39) + Chr(39))
>
> /gustav
>
>
>> Gustav, I get an error message 'automation type not supported in
>> Visual Basic', but in any case speed is not #1 issue, I am much more
>> concerned that it doesn't work for words with apostraphe, and when I
>> write Replace(MyRecord(0),"'","''") I get error ByRef mismatch....
>
> _______________________________________________
> 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