troubleshooting Question

importing a csv in to a table. Recognising line breaks

Avatar of Easty
Easty asked on
Microsoft Access
6 Comments1 Solution320 ViewsLast Modified:
I want to insert values from a csv file in to a table.
Im having trouble in recognising an EOL character
When i try and insert buffer(2) which is the last field i insert, it also has the date from the next line so the program isnt recognising when the 1st line is finished and the 2nd line has started

From the code i am also going through the code charachter by charater is there an easy way to go through line by line.

Open MyPathFile For Input As #1
                Do While Not EOF(1)
                     Do While MyChar <> vbLf
                     MyChar = Input(1, #1)
                     DataIn = DataIn + MyChar
                     buffer = Split(DataIn, ",")
                        DoCmd.RunSQL "INSERT INTO tlbTrans (DateOfTrans, PayeeName, Amount) " + _
                                    "VALUES ('" & buffer(0) & "','" & buffer(1) & "'," & buffer(2) & ")"
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros