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?
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: -
strTest = "Test<br>String<br>for<br>BikeToWork"
-
-
Me![txtTest] = strTest
-
produces & preserves -
Test
-
String
-
for
-
BikeToWork
-
within the Bound Rich Text Box.
8 8115
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?
This may be a silly question on my part, especially because I don't know a ton about VBA, but are you able to set a multiline property for the RTB? In VB.NET, if a textbox or RTB has the multiline property disabled it will not accept carriage returns.
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: -
strTest = "Test<br>String<br>for<br>BikeToWork"
-
-
Me![txtTest] = strTest
-
produces & preserves -
Test
-
String
-
for
-
BikeToWork
-
within the Bound Rich Text Box.
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.
You are quite welcome, so all works well?
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.
NeoPa 32,556
Expert Mod 16PB
I believe the .Value has all the codes but if you want the text without them then .Text has that.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Robert |
last post by:
I need some help with formatting some text received from a database
query. I am only selecting a single row per query so the formatting
will only be performed on a single row. The rows I need to...
|
by: Ike |
last post by:
Does anyone know where I can find example scritp for formatting text input?
I want to have a text box where only legitiamte filesname under unix can be
netered (no whitespace, only alphanumeric,...
|
by: msmcg |
last post by:
I need to format the data in some textboxes using the
Binding method with custom Currency and ShortDate format
and parse handlers.
Here is the code that I am using. I call it on the form
load...
|
by: Mitchell Vincent |
last post by:
I have a bunch of text boxes and labels that hold currency values. I
need some formatting on them, but since they are databound to a set, I'm
confused as to how to do that. Do labels and text boxes...
|
by: gsb58 |
last post by:
Hi!
In my application I save text from a RichText box to file, but when
previewing the text it turns out like:
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Verdana;}}...
|
by: korund |
last post by:
We can use special characters ('\n') to add line breaks in text in
JavaScript popup Alert boxes.
there is also few additional special characters:
\' single quote
\" double quote
\&...
|
by: michael sorens |
last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a
very simple task but I cannot find information on this. I am using a
RichTextBox as an output window. Some text I want to...
|
by: Glen |
last post by:
Hello again, I don't blame anyone for not answering my last post, since I
obviously hadn't spent much time researching, but I've come a little ways
and have another question.
How can I better...
|
by: drfreaky |
last post by:
Hello,
I want to use a richtextbox for logging status messages. I have three kind of message types and want to use different formatting for them.
My problem is, I change the color, add the text...
|
by: Rozzy |
last post by:
Hi, I'm having trouble using the proper terminology, so bear with me,
I am trying to submit text to a mysql database. I want to be able to
allow formatting of this content (like breaking it up into...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |