I am using Access 2007 and have a large textbox whose TextFormat is set as RTF and is bound to a memo field. There are several command buttons which automatically insert email text into the textbox, such as Header, Signature, etc. If the TextFormat for the textbox is plain text, the carriage returns and line feeds are all inserted according to what is in the code. However, if I switch the textbox to RTF TextFormat, it ignores the hard returns in the code and just inserts its own hard returns to wrap the text. Does anyone know of a workaround for this?
Formatting in RTF Text Box
Collapse
X
-
Tags: None
-
There is a 'long' work-a-round. Once Data is entered into the Bound Rich Text Box, you can physically insert Hard Carriage Returns (CTRL+ENTER) wherever appropriate, and the Formatting will persist. Hopefully, you or asomeone else, can come up with a 'shorter' work-a-round (LOL). -
Thanks, ADezii. I was looking for a more automated solution, if there is one. Why does the RTF text box just ignore the VBCRLF's in the code, whereas the plain text text box does not?Comment
-
I think that I have figured it out for you BikeToWork. The MEMO Field for a Bound Rich Text Box (txtTest in this case) appears to utilize HTML Encoding to properly Format the Rich Text contents. You need to use the HTML equivalent of a CR/LF in order to produce the same effect. Case in point:
produces & preservesCode:strTest = "Test<br>String<br>for<br>BikeToWork" Me![txtTest] = strTest
within the Bound Rich Text Box.Code:Test String for BikeToWork
Comment
-
Thanks again, ADezii. You are correct about the html code for the rtf control. Access puts it in automatically when the user puts in a hard return or bolds some text, etc.Comment
-
ADezii, unfortunately it won't work with my program. If I use <br> or <div> for new lines in the code, it will appear without the code tags in the text box but when I use the SendObject command to send the email, it shows up with all the html code tags, even if I specify acFormatHTML and select HTML format in Outlook. It was a good learning experience, though.Comment
Comment