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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing CR/LF from text or memo field 1

Status
Not open for further replies.

zevw

MIS
Jul 3, 2001
697
US
I have a text / memo fields that have a CR (Enter Key) in them and I want to display all the information on one line on the report. How can I remove the Carriage return?

Secondly: If I want to have all the info. till the CR and not anything afterwords. Is there a way with INSTR/MID function to specify a CR in this fuction?
 
sure, to replace, have a look at the replace function.

To display only info up to the Cr, you just need to use left and instr functions, like so:

Code:
left(string, instr(string, vbCr))

Ignorance of certain subjects is a great part of wisdom
 
Thanks in a report I wrote

Replace([fieldname], Chr(13), " ")

it works great!

The other part will need some more tweaking because it is a memo field with multiple CR.
 
That shouldn't matter, if you only want to show up to the first chr(13). Instr starts at position 0 (unless told otherwise) and counts only up until the next occurrence of what it is told to look for.

Glad you got the first part to work!

Alex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top