skjda352
04-02-2011, 01:39 AM
The other day I was working on a report where I wanted to build a sentence that included multiple fields from a record but I wanted to use rich text formatting to provide contrast. My scenario was pretty simple in that I wanted a bold title with a date trailing it. Some think like: This was a great book,Office Pro 2010 (http://www.office-2010-key.co.uk), reviewed on 1/12/2007 My problem was both fields were pulled from normal text fields and I wanted the data to trail immediately after the variable length title. Here is how I made it work inside Access. Add a control to the form/report. Change the control's Text Format property to Rich Text. Construct simple HTML in the control source. Mine looked something like:
="<div><strong>" & [Summary] & "</strong>,Office 2010 Serial (http://www.office-2010-key.co.uk/), <font color=""#A5A5A5""><em> reviewed on " & [ReviewDate] & "</em></font></div>" For a number of reasons the rich text control doesn't support the full range of HTML but rather a limited subset of HTML focused around formatting text. If you stick to the list of HTML tags and attributes below you should be safe: <font face="Arial Black" size=3 color="#A5A5A5" style="BACKGROUND-COLOR:#FFFF00">
<strong>
<em>
<u>
<br>
<div align=right dir=RTL>
<blockquote>
<ol> and <li> for number
<ul> and <li> for bulleted lists One gotcha you have to work around is handling quotes around attributes. Technically speaking all attributes in HTML should be surrounded by quotes. To have the string evaluate by the expression service to something that gets passed to the rich text control with the right syntax you need to use double quotes for any quote. In the example above <font color=""#A5A5A5""> will evaluate to <font color="#A5A5A5">. Alan Browne has published a good article for new users on Quotations marks within quotes. Lastly,Office Pro 2010 Product Key (http://www.office2010key.in/), there is a quick way to generate the HTML you need and make sure it is compliant with the Rich Text control. Create a test table with one rich text control field on it. Create a simple form with two controls bound to the rich text field. Change one of the text boxes to Text Format = Plain Text. Now you can see the formatted version and the HTML. Enjoy,Microsoft Office 2010 Cd Key (http://www.office2010key.eu)! <div
="<div><strong>" & [Summary] & "</strong>,Office 2010 Serial (http://www.office-2010-key.co.uk/), <font color=""#A5A5A5""><em> reviewed on " & [ReviewDate] & "</em></font></div>" For a number of reasons the rich text control doesn't support the full range of HTML but rather a limited subset of HTML focused around formatting text. If you stick to the list of HTML tags and attributes below you should be safe: <font face="Arial Black" size=3 color="#A5A5A5" style="BACKGROUND-COLOR:#FFFF00">
<strong>
<em>
<u>
<br>
<div align=right dir=RTL>
<blockquote>
<ol> and <li> for number
<ul> and <li> for bulleted lists One gotcha you have to work around is handling quotes around attributes. Technically speaking all attributes in HTML should be surrounded by quotes. To have the string evaluate by the expression service to something that gets passed to the rich text control with the right syntax you need to use double quotes for any quote. In the example above <font color=""#A5A5A5""> will evaluate to <font color="#A5A5A5">. Alan Browne has published a good article for new users on Quotations marks within quotes. Lastly,Office Pro 2010 Product Key (http://www.office2010key.in/), there is a quick way to generate the HTML you need and make sure it is compliant with the Rich Text control. Create a test table with one rich text control field on it. Create a simple form with two controls bound to the rich text field. Change one of the text boxes to Text Format = Plain Text. Now you can see the formatted version and the HTML. Enjoy,Microsoft Office 2010 Cd Key (http://www.office2010key.eu)! <div