• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 830
  • Last Modified:

How do I remove a carriage return from a text field when adding to a csv file?

I'm pulling records from a table and adding them to a csv file. Some of the comment fields have carriage returns in them which is screwing up the format of the csv file. How can I remove the carriage returns and make the comment field one continuous string?
0
TimHietanen
Asked:
TimHietanen
1 Solution
 
SethiCommented:
You can use the Replace function this way:
Replace(Yourfieldname," & chr(13)  & ","")
0
 
Patrick MatthewsCommented:
Hello TimHietanen,

Is it *only* a carriage return (Chr(13)), or is it the carriage return plus line break (Chr(13) & Chr(10); aka vbCrLf)?

You may want to try Replace(SomeColumn, Chr(13) & Chr(10), "")

Regards,

Patrick
0
 
TimHietanenAuthor Commented:
Thanks for the input. Worked perfectly.
0
 
strungCommented:
OS X follows the Unix convention of using only the carriage return Chr(13) and not the line feed (Chr10):

http://www.websiterepairguy.com/articles/os/crlf.html
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now