new line

  • Thread starter Thread starter ale
  • Start date Start date
A

ale

Hi! I am programming a website using asp and VB to access
a database in MS Access. Everything is working fine,
except for the following problem. The database fields
shown in the webpage lost the new line commands which I
input in Access with Ctrl-Enter. Does anybody know how to
show the text as input in MS Access? Thanx!
 
It sounds as if you're inserting the text from your Access fields
straight into an HTML string and the web browser is ignoring the
linebreaks. This is how it should be: linebreaks in HTML source code are
normally not significant (they just count as white space the same as the
spaces between these words).

To preserve the linebreaks, you can either put the text from Access into
<PRE> </PRE> tags (which preserve the original layout), or else replace
each linebreak with a <BR> tag.



Hi! I am programming a website using asp and VB to access
a database in MS Access. Everything is working fine,
except for the following problem. The database fields
shown in the webpage lost the new line commands which I
input in Access with Ctrl-Enter. Does anybody know how to
show the text as input in MS Access? Thanx!

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Thanks, John!
Actually yesterday I found info about the <PRE> tag, and
I tried to use it, but I still have a problem: the table
column where I'm inserting the text gets resized since
the text doesn't get wrapped as it does when the text is
not formatted. Is there a way to make it work without
replacing each linebreak with a <BR> tag?

CIAO
Ale


-----Original Message-----

It sounds as if you're inserting the text from your Access fields
straight into an HTML string and the web browser is ignoring the
linebreaks. This is how it should be: linebreaks in HTML source code are
normally not significant (they just count as white space the same as the
spaces between these words).

To preserve the linebreaks, you can either put the text from Access into
<PRE> </PRE> tags (which preserve the original layout), or else replace
each linebreak with a <BR> tag.



Hi! I am programming a website using asp and VB to access
a database in MS Access. Everything is working fine,
except for the following problem. The database fields
shown in the webpage lost the new line commands which I
input in Access with Ctrl-Enter. Does anybody know how to
show the text as input in MS Access? Thanx!

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 
Ciao Ale,

I'm not an HTML expert, but AFAIK the only way of getting a browser to
respect linebreaks in the source is to use <PRE>...</PRE>, but as you're
aware that assumes that you don't want the text to wrap. You can use the
WIDTH attribute to fix the width of the table cell, but that will hide
part of each line of the preformatted text.

So I think you're stuck with using <BR>, or possibly <P>...</P>,
depending on how you want the linebreaks in the field contents to appear
in the browser.

But there's no need to change your data. Instead, add them "on the fly"
as you're assembling the HTML string. E.g. (in Access 2000 and later)

Dim strS As String

strS = Nz(value of field containing line breaks, "")

strS = Replace(strS, vbCRLF, vbCRLF & "<BR>")
or
strS = "<P>" & Replace(strS, vbCRLF, "</P>" & vbCRLF & "<P>")

In Access 2002 and later you can even use the Replace() function in a
query; in Access 2000 you have to use a custom VBA function in the query
that calls Replace().


Thanks, John!
Actually yesterday I found info about the <PRE> tag, and
I tried to use it, but I still have a problem: the table
column where I'm inserting the text gets resized since
the text doesn't get wrapped as it does when the text is
not formatted. Is there a way to make it work without
replacing each linebreak with a <BR> tag?

CIAO
Ale


-----Original Message-----

It sounds as if you're inserting the text from your Access fields
straight into an HTML string and the web browser is ignoring the
linebreaks. This is how it should be: linebreaks in HTML source code are
normally not significant (they just count as white space the same as the
spaces between these words).

To preserve the linebreaks, you can either put the text from Access into
<PRE> </PRE> tags (which preserve the original layout), or else replace
each linebreak with a <BR> tag.



Hi! I am programming a website using asp and VB to access
a database in MS Access. Everything is working fine,
except for the following problem. The database fields
shown in the webpage lost the new line commands which I
input in Access with Ctrl-Enter. Does anybody know how to
show the text as input in MS Access? Thanx!

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Back
Top