By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,964 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,964 IT Pros & Developers. It's quick & easy.

carriage return in a text box

P: n/a
My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.

But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.

Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?
Sep 17 '08 #1
Share this Question
Share on Google+
11 Replies


P: n/a
evenlater wrote:
My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.

But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.

Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the TextBox's After Update event procedure to add the vbCrLf:

If Not IsNull(Me!txtBody) then
If Right$(Me!txtBody,2) <vbCrLf Then
Me!txtBody = Me!txtBody & vbCrLf
End If
End If

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----
Sep 17 '08 #2

P: n/a
I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.
On Sep 16, 11:41*pm, MGFoster <m...@privacy.comwrote:
evenlater wrote:
My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.
But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.
Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the TextBox's After Update event procedure to add the vbCrLf:

* *If Not IsNull(Me!txtBody) then
* * *If Right$(Me!txtBody,2) <vbCrLf Then
* * * *Me!txtBody = Me!txtBody & vbCrLf
* * *End If
* *End If

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. *I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----
Sep 17 '08 #3

P: n/a
evenlater wrote:
I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.
Can't you just call the AfterUpdate event in the OnLoad sub?

Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate
>

On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>evenlater wrote:
>>>My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.
>>>But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.
>>>Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Use the TextBox's After Update event procedure to add the vbCrLf:

If Not IsNull(Me!txtBody) then
If Right$(Me!txtBody,2) <vbCrLf Then
Me!txtBody = Me!txtBody & vbCrLf
End If
End If

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----

Sep 17 '08 #4

P: n/a
No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?

On Sep 17, 1:46*pm, Salad <o...@vinegar.comwrote:
evenlater wrote:
I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.

Can't you just call the AfterUpdate event in the OnLoad sub?

Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate
On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>evenlater wrote:
>>My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.
>>But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.
>>Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?
>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>Use the TextBox's After Update event procedure to add the vbCrLf:
* If Not IsNull(Me!txtBody) then
* * If Right$(Me!txtBody,2) <vbCrLf Then
* * * Me!txtBody = Me!txtBody & vbCrLf
* * End If
* End If
>--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. *I DO NOT respond to emails **
>-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----
Sep 17 '08 #5

P: n/a
evenlater wrote:
No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?
I have.

I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code.
Private Sub Form_Load()
Me.Text0 = "This" & vbNewLine & "Is" & _
vbNewLine & "A" & vbNewLine & "Test"
End Sub
It works as expected. Then again, my message body is plain text.

>
On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>evenlater wrote:
>>>I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.

Can't you just call the AfterUpdate event in the OnLoad sub?

Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate

>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>evenlater wrote:
>>>>>My db allows the user to send email via CDO. The body of the email is
>determined in code. I have built an email form with To, CC and Subject
>lines and a large text box for the body of the message so the user can
>edit the default email message body before sending the message.
>>>>>But when I populate the large text box (txtBody), I can't get it to
>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
>Key Behavior to "New Line in Field". Doesn't help.
>>>>>Is it possible to populate a text box in Access with VBA so that it
>will include carriage returns?
>>>>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>> If Not IsNull(Me!txtBody) then
If Right$(Me!txtBody,2) <vbCrLf Then
Me!txtBody = Me!txtBody & vbCrLf
End If
End If
>>>>--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **
>>>>-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----

Sep 17 '08 #6

P: n/a
I tried your code and it still doesn't work for me. It plugs in the
text, but not the carriage returns (i.e., "This is a Test"). What
version of Access are you using?

On Sep 17, 2:34*pm, Salad <o...@vinegar.comwrote:
evenlater wrote:
No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?

I have.

I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code.
* * * * Private Sub Form_Load()
* * * * * * * * Me.Text0 = "This" & vbNewLine & "Is" & _
* * * * * * * * * * * * vbNewLine & "A" & vbNewLine & "Test"
* * * * End Sub
It works as expected. *Then again, my message body is plain text.
On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>evenlater wrote:
>>I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.
>Can't you just call the AfterUpdate event in the OnLoad sub?
>Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate
>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>evenlater wrote:
>>>>My db allows the user to send email via CDO. The body of the email is
determined in code. I have built an email form with To, CC and Subject
lines and a large text box for the body of the message so the user can
edit the default email message body before sending the message.
>>>>But when I populate the large text box (txtBody), I can't get it to
include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
Key Behavior to "New Line in Field". Doesn't help.
>>>>Is it possible to populate a text box in Access with VBA so that it
will include carriage returns?
>>>-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>*If Not IsNull(Me!txtBody) then
* *If Right$(Me!txtBody,2) <vbCrLf Then
* * *Me!txtBody = Me!txtBody & vbCrLf
* *End If
*End If
>>>--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. *I DO NOT respond to emails **
>>>-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
Wm5g0/Np9BmoCj4OyS35D68d
=GriS
-----END PGP SIGNATURE-----
Sep 17 '08 #7

P: n/a
evenlater wrote:
I tried your code and it still doesn't work for me. It plugs in the
text, but not the carriage returns (i.e., "This is a Test"). What
version of Access are you using?
97 and 2003. Both have the same results. You mentioned you had a text
box formated as Rich Text, however you did that. Maybe that's the
difference. Mine is a straight forward text box, no bells or whistles,
with the EnterKeyBehavior allowing NewLine.
>
On Sep 17, 2:34 pm, Salad <o...@vinegar.comwrote:
>>evenlater wrote:
>>>No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?

I have.

I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code.
Private Sub Form_Load()
Me.Text0 = "This" & vbNewLine & "Is" & _
vbNewLine & "A" & vbNewLine & "Test"
End Sub
It works as expected. Then again, my message body is plain text.

>>>On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>>>evenlater wrote:
>>>>>I'm not sure how that would work? I'm plugging the body of the message
>into txtBody using the Form_Load event... that doesn't trigger
>txtBody_AfterUpdate, so the carriage returns wouldn't be added until
>the user edited the text box. I want the carriage returns there the
>instant the form opens.
>>>>Can't you just call the AfterUpdate event in the OnLoad sub?
>>>>Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate
>>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>>>evenlater wrote:
>>>>>>>My db allows the user to send email via CDO. The body of the email is
>>>determined in code. I have built an email form with To, CC and Subject
>>>lines and a large text box for the body of the message so the user can
>>>edit the default email message body before sending the message.
>>>>>>>But when I populate the large text box (txtBody), I can't get it to
>>>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>>>and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
>>>Key Behavior to "New Line in Field". Doesn't help.
>>>>>>>Is it possible to populate a text box in Access with VBA so that it
>>>will include carriage returns?
>>>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>>>>If Not IsNull(Me!txtBody) then
> If Right$(Me!txtBody,2) <vbCrLf Then
> Me!txtBody = Me!txtBody & vbCrLf
> End If
>End If
>>>>>>--
>>MGFoster:::mgf00 <atearthlink <decimal-pointnet
>>Oakland, CA (USA)
>>** Respond only to this newsgroup. I DO NOT respond to emails **
>>>>>>-----BEGIN PGP SIGNATURE-----
>>Version: PGP for Personal Privacy 5.0
>>Charset: noconv
>>>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
>>Wm5g0/Np9BmoCj4OyS35D68d
>>=GriS
>>-----END PGP SIGNATURE-----

Sep 17 '08 #8

P: n/a
Bingo! I had to change the text box TextFormat property back to Plain
Text and use .TextBody in my CDO code instead of .HTMLBody.
Salad, you're a life saver.

On Sep 17, 4:26*pm, Salad <o...@vinegar.comwrote:
evenlater wrote:
I tried your code and it still doesn't work for me. It plugs in the
text, but not the carriage returns (i.e., "This is a Test"). What
version of Access are you using?

97 and 2003. *Both have the same results. *You mentioned you had a text
box formated as Rich Text, however you did that. *Maybe that's the
difference. *Mine is a straight forward text box, no bells or whistles,
with the EnterKeyBehavior allowing NewLine.
On Sep 17, 2:34 pm, Salad <o...@vinegar.comwrote:
>evenlater wrote:
>>No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?
>I have.
>I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code.
* * * *Private Sub Form_Load()
* * * * * * * *Me.Text0 = "This" & vbNewLine & "Is" & _
* * * * * * * * * * * *vbNewLine & "A" & vbNewLine & "Test"
* * * *End Sub
It works as expected. *Then again, my message body is plain text.
>>On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>>evenlater wrote:
>>>>I'm not sure how that would work? I'm plugging the body of the message
into txtBody using the Form_Load event... that doesn't trigger
txtBody_AfterUpdate, so the carriage returns wouldn't be added until
the user edited the text box. I want the carriage returns there the
instant the form opens.
>>>Can't you just call the AfterUpdate event in the OnLoad sub?
>>>Me.Txt = Me.Txt & vbNewLine
Call Txt_AfterUpdate
>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>>evenlater wrote:
>>>>>>My db allows the user to send email via CDO. The body of the emailis
>>determined in code. I have built an email form with To, CC and Subject
>>lines and a large text box for the body of the message so the usercan
>>edit the default email message body before sending the message.
>>>>>>But when I populate the large text box (txtBody), I can't get it to
>>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>>and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
>>Key Behavior to "New Line in Field". Doesn't help.
>>>>>>Is it possible to populate a text box in Access with VBA so that it
>>will include carriage returns?
>>>>>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>>>If Not IsNull(Me!txtBody) then
* If Right$(Me!txtBody,2) <vbCrLf Then
* * Me!txtBody = Me!txtBody & vbCrLf
* End If
End If
>>>>>--
>MGFoster:::mgf00 <atearthlink <decimal-pointnet
>Oakland, CA (USA)
>** Respond only to this newsgroup. *I DO NOT respond to emails **
>>>>>-----BEGIN PGP SIGNATURE-----
>Version: PGP for Personal Privacy 5.0
>Charset: noconv
>>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
>Wm5g0/Np9BmoCj4OyS35D68d
>=GriS
>-----END PGP SIGNATURE-----
Sep 17 '08 #9

P: n/a
evenlater wrote:
Bingo! I had to change the text box TextFormat property back to Plain
Text and use .TextBody in my CDO code instead of .HTMLBody.
Salad, you're a life saver.
You are welcome.

I don't know what a TextFormat property is. Are you using A2007?

>
On Sep 17, 4:26 pm, Salad <o...@vinegar.comwrote:
>>evenlater wrote:
>>>I tried your code and it still doesn't work for me. It plugs in the
text, but not the carriage returns (i.e., "This is a Test"). What
version of Access are you using?

97 and 2003. Both have the same results. You mentioned you had a text
box formated as Rich Text, however you did that. Maybe that's the
difference. Mine is a straight forward text box, no bells or whistles,
with the EnterKeyBehavior allowing NewLine.

>>>On Sep 17, 2:34 pm, Salad <o...@vinegar.comwrote:
>>>>evenlater wrote:
>>>>>No, that doesn't work. And it doesn't work to try to add the new line
>in the OnLoad event. It'll plug in text, but not a carriage return.
>This is puzzling to me... surely there must be others who've used an
>Access form to send an email message?
>>>>I have.
>>>>I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code.
Private Sub Form_Load()
Me.Text0 = "This" & vbNewLine & "Is" & _
vbNewLine & "A" & vbNewLine & "Test"
End Sub
It works as expected. Then again, my message body is plain text.
>>>>>On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>>>>>evenlater wrote:
>>>>>>>I'm not sure how that would work? I'm plugging the body of the message
>>>into txtBody using the Form_Load event... that doesn't trigger
>>>txtBody_AfterUpdate, so the carriage returns wouldn't be added until
>>>the user edited the text box. I want the carriage returns there the
>>>instant the form opens.
>>>>>>Can't you just call the AfterUpdate event in the OnLoad sub?
>>>>>>Me.Txt = Me.Txt & vbNewLine
>>Call Txt_AfterUpdate
>>>>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>>>>>evenlater wrote:
>>>>>>>>>My db allows the user to send email via CDO. The body of the email is
>>>>>determined in code. I have built an email form with To, CC and Subject
>>>>>lines and a large text box for the body of the message so the user can
>>>>>edit the default email message body before sending the message.
>>>>>>>>>But when I populate the large text box (txtBody), I can't get it to
>>>>>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>>>>>and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
>>>>>Key Behavior to "New Line in Field". Doesn't help.
>>>>>>>>>Is it possible to populate a text box in Access with VBA so that it
>>>>>will include carriage returns?
>>>>>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>>Hash: SHA1
>>>>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>>>>>>>If Not IsNull(Me!txtBody) then
>>> If Right$(Me!txtBody,2) <vbCrLf Then
>>> Me!txtBody = Me!txtBody & vbCrLf
>>> End If
>>>>End If
>>>>>>>>--
>>>>MGFoster:::mgf00 <atearthlink <decimal-pointnet
>>>>Oakland, CA (USA)
>>>>** Respond only to this newsgroup. I DO NOT respond to emails **
>>>>>>>>-----BEGIN PGP SIGNATURE-----
>>>>Version: PGP for Personal Privacy 5.0
>>>>Charset: noconv
>>>>>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
>>>>Wm5g0/Np9BmoCj4OyS35D68d
>>>>=GriS
>>>>-----END PGP SIGNATURE-----

Sep 17 '08 #10

P: n/a
Yes, I'm using 2007 and Text Format is a new property with the new
version. Honestly, I'm not really sure what it's used for. All Access
Help has to say about it is that it "gets or sets whether rich text is
displayed in the specified text box."

On Sep 17, 5:50*pm, Salad <o...@vinegar.comwrote:
evenlater wrote:
Bingo! I had to change the text box TextFormat property back to Plain
Text and use .TextBody in my CDO code instead of .HTMLBody.
Salad, you're a life saver.

You are welcome.

I don't know what a TextFormat property is. *Are you using A2007?
On Sep 17, 4:26 pm, Salad <o...@vinegar.comwrote:
>evenlater wrote:
>>I tried your code and it still doesn't work for me. It plugs in the
text, but not the carriage returns (i.e., "This is a Test"). What
version of Access are you using?
>97 and 2003. *Both have the same results. *You mentioned you had a text
box formated as Rich Text, however you did that. *Maybe that's the
difference. *Mine is a straight forward text box, no bells or whistles,
with the EnterKeyBehavior allowing NewLine.
>>On Sep 17, 2:34 pm, Salad <o...@vinegar.comwrote:
>>>evenlater wrote:
>>>>No, that doesn't work. And it doesn't work to try to add the new line
in the OnLoad event. It'll plug in text, but not a carriage return.
This is puzzling to me... surely there must be others who've used an
Access form to send an email message?
>>>I have.
>>>I just created a form with an unbound text box (Text0), set the
EnterKeyBehavior to New Line in Field and have this OnLoad event code..
* * * Private Sub Form_Load()
* * * * * * * Me.Text0 = "This" & vbNewLine & "Is" &_
* * * * * * * * * * * vbNewLine & "A" & vbNewLine & "Test"
* * * End Sub
It works as expected. *Then again, my message body is plain text.
>>>>On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>>>>evenlater wrote:
>>>>>>I'm not sure how that would work? I'm plugging the body of the message
>>into txtBody using the Form_Load event... that doesn't trigger
>>txtBody_AfterUpdate, so the carriage returns wouldn't be added until
>>the user edited the text box. I want the carriage returns there the
>>instant the form opens.
>>>>>Can't you just call the AfterUpdate event in the OnLoad sub?
>>>>>Me.Txt = Me.Txt & vbNewLine
>Call Txt_AfterUpdate
>>>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>>>>evenlater wrote:
>>>>>>>>My db allows the user to send email via CDO. The body of the email is
>>>>determined in code. I have built an email form with To, CC and Subject
>>>>lines and a large text box for the body of the message so the user can
>>>>edit the default email message body before sending the message.
>>>>>>>>But when I populate the large text box (txtBody), I can't get itto
>>>>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>>>>and Chr(13). I've got the Text Format set to "Rich Text" and theEnter
>>>>Key Behavior to "New Line in Field". Doesn't help.
>>>>>>>>Is it possible to populate a text box in Access with VBA so thatit
>>>>will include carriage returns?
>>>>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>Hash: SHA1
>>>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>>>>>>If Not IsNull(Me!txtBody) then
>>*If Right$(Me!txtBody,2) <vbCrLf Then
>>* *Me!txtBody = Me!txtBody & vbCrLf
>>*End If
>>>End If
>>>>>>>--
>>>MGFoster:::mgf00 <atearthlink <decimal-pointnet
>>>Oakland, CA (USA)
>>>** Respond only to this newsgroup. *I DO NOT respond to emails **
>>>>>>>-----BEGIN PGP SIGNATURE-----
>>>Version: PGP for Personal Privacy 5.0
>>>Charset: noconv
>>>>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
>>>Wm5g0/Np9BmoCj4OyS35D68d
>>>=GriS
>>>-----END PGP SIGNATURE-----
Sep 18 '08 #11

P: n/a
evenlater wrote:
Yes, I'm using 2007 and Text Format is a new property with the new
version. Honestly, I'm not really sure what it's used for. All Access
Help has to say about it is that it "gets or sets whether rich text is
displayed in the specified text box."
Thanks for the update. I believe with RFT you can do boldings and
underlines and other formatting of text. Most likely it was the HTLM
part that didn't accept the newlines. If you created a file like
This
is
a
test
and saved it as HTML and opened it in a browser it looks like
This is a test

Anyway, glad you got the thing to work.

>
On Sep 17, 5:50 pm, Salad <o...@vinegar.comwrote:
>>evenlater wrote:
>>>Bingo! I had to change the text box TextFormat property back to Plain
Text and use .TextBody in my CDO code instead of .HTMLBody.
Salad, you're a life saver.

You are welcome.

I don't know what a TextFormat property is. Are you using A2007?

>>>On Sep 17, 4:26 pm, Salad <o...@vinegar.comwrote:
>>>>evenlater wrote:
>>>>>I tried your code and it still doesn't work for me. It plugs in the
>text, but not the carriage returns (i.e., "This is a Test"). What
>version of Access are you using?
>>>>97 and 2003. Both have the same results. You mentioned you had a text
box formated as Rich Text, however you did that. Maybe that's the
difference. Mine is a straight forward text box, no bells or whistles,
with the EnterKeyBehavior allowing NewLine.
>>>>>On Sep 17, 2:34 pm, Salad <o...@vinegar.comwrote:
>>>>>>evenlater wrote:
>>>>>>>No, that doesn't work. And it doesn't work to try to add the new line
>>>in the OnLoad event. It'll plug in text, but not a carriage return.
>>>This is puzzling to me... surely there must be others who've used an
>>>Access form to send an email message?
>>>>>>I have.
>>>>>>I just created a form with an unbound text box (Text0), set the
>>EnterKeyBehavior to New Line in Field and have this OnLoad event code.
> Private Sub Form_Load()
> Me.Text0 = "This" & vbNewLine & "Is" & _
> vbNewLine & "A" & vbNewLine & "Test"
> End Sub
>>It works as expected. Then again, my message body is plain text.
>>>>>>>On Sep 17, 1:46 pm, Salad <o...@vinegar.comwrote:
>>>>>>>>evenlater wrote:
>>>>>>>>>I'm not sure how that would work? I'm plugging the body of the message
>>>>>into txtBody using the Form_Load event... that doesn't trigger
>>>>>txtBody_AfterUpdate, so the carriage returns wouldn't be added until
>>>>>the user edited the text box. I want the carriage returns there the
>>>>>instant the form opens.
>>>>>>>>Can't you just call the AfterUpdate event in the OnLoad sub?
>>>>>>>>Me.Txt = Me.Txt & vbNewLine
>>>>Call Txt_AfterUpdate
>>>>>>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.comwrote:
>>>>>>>>>>evenlater wrote:
>>>>>>>>>>>My db allows the user to send email via CDO. The body of the email is
>>>>>>>determined in code. I have built an email form with To, CC and Subject
>>>>>>>lines and a large text box for the body of the message so the user can
>>>>>>>edit the default email message body before sending the message.
>>>>>>>>>>>But when I populate the large text box (txtBody), I can't get it to
>>>>>>>include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
>>>>>>>and Chr(13). I've got the Text Format set to "Rich Text" and the Enter
>>>>>>>Key Behavior to "New Line in Field". Doesn't help.
>>>>>>>>>>>Is it possible to populate a text box in Access with VBA so that it
>>>>>>>will include carriage returns?
>>>>>>>>>>-----BEGIN PGP SIGNED MESSAGE-----
>>>>>>Hash: SHA1
>>>>>>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
>>>>>>>>>>If Not IsNull(Me!txtBody) then
>>>>>If Right$(Me!txtBody,2) <vbCrLf Then
>>>>> Me!txtBody = Me!txtBody & vbCrLf
>>>>>End If
>>>>>>End If
>>>>>>>>>>--
>>>>>>MGFoster:::mgf00 <atearthlink <decimal-pointnet
>>>>>>Oakland, CA (USA)
>>>>>>** Respond only to this newsgroup. I DO NOT respond to emails **
>>>>>>>>>>-----BEGIN PGP SIGNATURE-----
>>>>>>Version: PGP for Personal Privacy 5.0
>>>>>>Charset: noconv
>>>>>>>>>>iQA/AwUBSNCKaIechKqOuFEgEQIfyACcC2UZ7b1pKkHg26WxjAAc0A 7GexsAnjDX
>>>>>>Wm5g0/Np9BmoCj4OyS35D68d
>>>>>>=GriS
>>>>>>-----END PGP SIGNATURE-----

Sep 18 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.