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

Retaining line breaks in an Access data memo field

Status
Not open for further replies.

Boblevien

Technical User
Nov 3, 2000
38
GB
I’m trying to write the contents of a particular form field, which consists of several paragraphs, into an Access database and then display it later in an ASP page – without losing the line breaks.

Since Access stores it as one long string I guess I have to embed the carriage returns into the string AND decode it when I display it, but how?

Or is there another, better, approach?
 
This is the function I use
Code:
	function prepOutput(strIn)
	
		dim strOut
		
		strOut=""
		
		'replace carriage returns with breaks
		strOut=Replace(strIn,chr(13),&quot;<br>&quot;)
		
		'return the new string
		prepOutput=strOut
		
	end function

I would try something like this before assuming that access does not store the line breaks. I know that SQL Server stores the line breaks maybe access does too.

Hope this helps
Crystal
crystalized_s@yahoo.com

--------------------------------------------------

Experience is one thing you can't get for nothing.

-Oscar Wilde

 
You can indeed store carriage returns in an access database. To keep the line breaks when you display the text as html, you can use Crytal's method, or you can display the field using the preformated tag:[ignore] <PRE></PRE>[/ignore]


nick bulka

 
this works too, just for reference... from
VBScript
<%=Replace(rsName.Fields.Item(&quot;MemoColumn&quot;).Value,chr(13),&quot;<br>&quot;)%>

JavaScript
<%=String(rsName.Fields.Item(&quot;MemoColumn&quot;).Value).replace(/\r/g, &quot;<br />&quot;)%>


Cold Fusion (Thanks to Tom Muck - Basic UltraDev)
<cfoutput>#Replace(rsName.MemoColumn,chr(10), &quot;<br>&quot;,&quot;all&quot;)#</cfoutput>

PHP (Thanks to Tom Muck - Basic UltraDev)
<?php echo str_replace(&quot;\n&quot;,&quot;<br>&quot;,$rsName->Fields(&quot;MemoColumn&quot;))?>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top