Forums

ASP

This topic is locked

Microsoft Access Tables

Posted 04 May 2003 11:05:58
1
has voted
04 May 2003 11:05:58 Lewis Killorn posted:
Hi
I regularly create web site using MS Access Databases and wondered if anyone could answer my query.

From a memo field in a table I want to be able to input data with line breaks and at the moment when I input the info into the table I do so as follows:

Sentence
<br><br>
next sentence
<br><br>
next sentence

and so on.

When I then put this field on an ASP page the data displays as HTML.

What I want to be able to do is not have to input the HTML code in the database but still get the line breaks.

How do I set this in the access table????????

Replies

Replied 04 May 2003 13:53:27
04 May 2003 13:53:27 Talal Nabil replied:
hey LewisK,

I guess you will have to manage it in your page. I normally use this one which is quite good for me

Just insert the following function on the top of your page :

function FormatStr(fString)
fString = Replace(fString, CHR(10), "<br />"
FormatStr = fString
end function

Then when Insert the field you want format it do this:

formatStr(RS.Fields.Item("Your_Field".Value)

That's it
Replied 06 May 2003 16:51:24
06 May 2003 16:51:24 Dan Berdusco replied:
Or, similarily, you can simply replace this:

<b><pre id=code><font face=courier size=2 id=code>&lt;%=(rsName.Fields.Item("content".Value)%&gt;</font id=code></pre id=code></b>

With this:

<b><pre id=code><font face=courier size=2 id=code>&lt;%=Replace(rsName.Fields.Item("content".Value,Chr(13),"&lt;BR&gt;"%&gt;</font id=code></pre id=code></b>



(ASP, VBScript)
Replied 06 May 2003 17:21:24
06 May 2003 17:21:24 Vince Baker replied:
Just to jump on the band wagon...

you could use:

&lt;%=Replace(rsName.Fields.Item("content".Value, VbCrLf, "&lt;BR&gt;"%&gt;


in place of

&lt;%=rsName.Fields.Item("content".Value%&gt;


Regards
Vince

Visit my home: www.chez-vince.com

VBScript | ASP | HTML | SQL | Oracle | Hosting

Reply to this topic