Microsoft KB Archive/269599

= Access line breaks are not displayed in FrontPage Database Results Region =

Article ID: 269599

Article Last Modified on 1/27/2007

-

APPLIES TO


 * Microsoft Office FrontPage 2003
 * Microsoft FrontPage 2002 Standard Edition
 * Microsoft FrontPage 2000 Standard Edition

-



This article was previously published under Q269599



SYMPTOMS
Text that you expect to appear as separate lines in a Database Results Region appears, instead, as a single unbroken string of characters.



CAUSE
In Microsoft Access, lines of text are separated by a carriage return followed by a line feed, which is often abbreviated as CRLF. When a CRLF combination is displayed in a Web page, a Web browser ignores it, because the HTML specification states that line feeds are ignored as &quot;White Space&quot;.

Note See the &quot;More Information&quot; and &quot;References&quot; sections for additional details.



WORKAROUND
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To work around this behavior, replace the CRLF character sequences used by Access with the  tag using Active Server Pages (ASP) code.

Code Sample
Note You may receive an error message if you copy and paste the examples directly from this article to FrontPage. The angle brackets (&quot;<&quot; and &quot;>&quot;) may appear as escaped HTML code (&quot;<&quot; and &quot;>&quot;). To work around this behavior, paste the script in a blank Notepad document, and then copy it from Notepad before pasting it into FrontPage.  To create a form page, follow these steps:  Start FrontPage and open a Web site on a Web server that is running Internet Information Services 4.0 or later. On the File menu, click New, and then click Page. Select Normal Page from the list of available templates, and then click OK. On the File menu, click Save As. In the File name box, type FormTest.asp and then click Save. On the Insert menu, point to Form, and then click Scrolling Text Box.</li> Right-click the text box. On the shortcut menu, click Form Field Properties.</li> Make the following changes in the Scrolling Text Box Properties dialog box: <ul> Name = Sample</li> Width in characters = 40</li> Number of lines = 10</li></ul> </li> Click OK to close the Scrolling Text Box Properties dialog box.</li> Right-click the form. On the shortcut menu, click Form Properties.</li> In the Form Properties dialog box, select Send to database, and then click Options.</li> In the Options for Saving Results to Database dialog box, click Create Database. Click OK in each dialog box to return to the page FormTest.asp.</li> On the toolbar, click Save.</li> Click Preview in Browser on the FrontPage toolbar.</li>  Click in the text area, and then type the following lines. Press ENTER twice at the end of each of the first two sentences: <pre class="fixed_text">This is a test.

This block of text has three lines.

They are separated by blank lines. </li> Click the Submit button to submit the information to the database.</li> Close your Web browser.</li></ol> </li> To create a display page, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>On the FrontPage File menu, point to New, click Page, select Normal Page, and then click OK to create another new blank page. Save the page as DisplayTest.asp .</li> <li>On the Insert menu, point to Database, and then click Results.</li> <li>In page 1 of the Database Results Wizard, select FormTest and then click Next.</li> <li>In page 2, select Results and then click Next.</li> <li>In page 3, click Edit List.</li> <li>In the Displayed fields list, remove all fields except Sample, click OK, and then click Next.</li> <li>In page 4, select List - one field per item from the formatting options and Paragraphs from the list options, and then click Next.</li> <li>In page 5, select Display all records together, and then click Finish.</li> <li>Save the page.</li> <li>Click Preview in Browser on the FrontPage toolbar.</li> <li>When the page is displayed, the text appears without line breaks.</li> <li>Close your Web browser.</li></ol> </li> <li>To implement the workaround, follow these steps: <ol style="list-style-type: lower-alpha;"> <li>Open DisplayTest.asp, click < > and then press DELETE.</li> <li> Switch to HTML view and locate the HTML code that is similar to the following: Sample:&#xa0; </li> <li> Change the HTML code to the following: Sample:&#xa0;<%=Replace(FP_FieldVal(fp_rs,&quot;Sample&quot;),vbCrLf,&quot; &quot;)%> Note The ASP code FP_FieldVal(fp_rs,&quot;Sample&quot;) is FrontPage's code for returning a database column, and <%=Replace(FP_FieldVal(fp_rs,&quot;Sample&quot;),vbCrLf,&quot; &quot;)%> is the ASP code to format a database column with all the carriage returns replaced by HTML &quot;line breaks&quot;. </li> <li>On the toolbar, click Save, and then click Preview in Browser.</li> <li>When the page is displayed, the text appears with line breaks.</li></ol> </li></ol>

<div class="moreinformation_section">

MORE INFORMATION
Lines of text are separated in computer programs by a line break, also called an end of line (EOL). This may be a single character or a sequence of characters. The actual characters used may vary between different programs. In Access, the line break sequence is defined as a carriage return followed by a line feed, which is Chr(13) followed by Chr(10) in ASCII and defined as the constant vbCrLf in Visual Basic.

The Hypertext Markup Language (HTML) specification states that &quot;White Space&quot; is to be ignored when a Web browser parses the HTML code for a page. Generally, this &quot;White Space&quot; refers to extra spaces between the words on a page; for example, two spaces after the end of a sentence are truncated to a single space when displayed on a Web page. The HTML specification defines that a line break is to be treated as white space and therefore ignored. When the Database Results Region correctly displays multiline text from a database in the HTML code, the separate lines of text may then appear to be a single line of text.

The HTML specification states that line breaks are represented by the <BR> formatting tag. By using the code presented in this article in your page, you can replace the Access line breaks with the correct HTML tag to accurately represent the text.

<div class="references_section">