Oleg_123 at xuppa.com
Oleg_123 at xuppa.com
Tue Oct 14 11:10:25 CDT 2003
Hey Group I have to convert a CSV file to Access table, with one of the records changing from yearmonthdate(19980123) to monthdateyear(01231998) format. So I gues I can't use macro for that since it doesn't recognise yearmonthdate format. I wrote the code below yesterday and tested it at home on diff table and it worked up till including Debug.Print aRecord(8)line then I had trouble sending received data to table. Now it doesn't work at all.. any suggestions ? 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 aRecord = split(strLine, ",") aRecord(8) = Mid(aRecord(8), 5) & Left(aRecord(8), 4) Debug.Print aRecord(8) strSQL = "INSERT table value(" & 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