Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove CR/LineFeed/vbCrLf from Text Field

Status
Not open for further replies.

MAT2001

Technical User
Feb 22, 2001
20
CA
I am trying to create a formula in Crystal Reports 8.5 using Visual Basic.

Require the Text field to have all carriage returns removed, but have not been able to get the 'replace' command to work. Note that I browsed the data field while in Crystal and see the CR as little black boxes!

The end result I am looking for is to have text print and wrap at approx. 30 characters, and then if necessary add a CR at end to ensure that the data fills even number of lines. So if last line of data writes to an odd line the CR will be added to force a blank line at bottom, which then keeps record use to even lines.

I am fairly new at programming and would really appreciate any help! Have tried using Crystal formulas with no luck, as fairly limiting. TY





 
MAT2001: The solution may be to remove the existing carriage returns - use Replace(field,chr(13),chr(9)) for example to find all the carriage returns and replace with a tab (or you could use any other non-printing character but be prepared for the effect on print!)

This will result in a continuous stream of characters which you can then 'chop up' into 30 characters chunks and re-combine using e.g. Chunk1+chr(13)+chunk2+chr(13) etc. etc.

HTH David C. Monks
david.monks@chase-international.com
Accredited Seagate Enterprise Partner
 
Through some additional reseach came up with an idea that lead me to do the following replace command in Crystal Reports.
VDesc = Replace(ItemDesc, chr(13) & chr(10), " ")

Originally I had two replace lines in formula one for the chr(13) & another for chr(10), which did not work. For some reason searching for them together one after the other works!

Appreciate all the help! Total newbie and learning as I go.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top