can't display line breaks

Results 1 to 2 of 2

Thread: can't display line breaks

  1. #1
    Join Date
    Dec 1969

    Default can't display line breaks

    I have a simple message board, which stores messages in an Access database. But when I display messages, line breaks that users entered are not shown- how do I search and replace the strings for breaks, so that they display properly (with <BR>&#039s or something)?<BR><BR>Look, this one does it!?!?!<BR><BR>Should I manipulate the string when reading from the DB for display, or manipulate it before it&#039s stored in the DB? Thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: can't display line breaks

    Well, the output is HTML and HTML is whitespace-insensitive. What&#039s a line break in HTML? The &lt;br&gt; tag of course! So:<BR><BR>Replace(string, vbCRLF, "&lt;br&gt;")<BR><BR>As for whether you do it before or after storage, that&#039s up to you. Doesn&#039t usually make a huge amount of difference, but if you read more often than you insert (as is usual) then you&#039re probably better doing it on insert - that way you only do the Replace once.<BR><BR>Dunc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts