carriage return in a text box

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • evenlater

    carriage return in a text box

    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?
  • MGFoster

    #2
    Re: carriage return in a text box

    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!txtBo dy) then
    If Right$(Me!txtBo dy,2) <vbCrLf Then
    Me!txtBody = Me!txtBody & vbCrLf
    End If
    End If

    --
    MGFoster:::mgf0 0 <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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
    Wm5g0/Np9BmoCj4OyS35D 68d
    =GriS
    -----END PGP SIGNATURE-----

    Comment

    • evenlater

      #3
      Re: carriage return in a text box

      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_AfterUp date, 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.c omwrote:
      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!txtBo dy) then
           If Right$(Me!txtBo dy,2) <vbCrLf Then
             Me!txtBody = Me!txtBody & vbCrLf
           End If
         End If
      >
      --
      MGFoster:::mgf0 0 <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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
      Wm5g0/Np9BmoCj4OyS35D 68d
      =GriS
      -----END PGP SIGNATURE-----

      Comment

      • Salad

        #4
        Re: carriage return in a text box

        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_AfterUp date, 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.c omwrote:
        >
        >>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!txtBo dy) then
        > If Right$(Me!txtBo dy,2) <vbCrLf Then
        > Me!txtBody = Me!txtBody & vbCrLf
        > End If
        > End If
        >>
        >>--
        >>MGFoster:::mg f00 <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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
        >>Wm5g0/Np9BmoCj4OyS35D 68d
        >>=GriS
        >>-----END PGP SIGNATURE-----
        >
        >

        Comment

        • evenlater

          #5
          Re: carriage return in a text box

          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.c omwrote:
          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_AfterUp date, 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.c omwrote:
          >
          >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!txtBo dy) then
              If Right$(Me!txtBo dy,2) <vbCrLf Then
                Me!txtBody = Me!txtBody & vbCrLf
              End If
            End If
          >
          >--
          >MGFoster:::mgf 00 <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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
          >Wm5g0/Np9BmoCj4OyS35D 68d
          >=GriS
          >-----END PGP SIGNATURE-----

          Comment

          • Salad

            #6
            Re: carriage return in a text box

            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
            EnterKeyBehavio r 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.c omwrote:
            >
            >>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_Afte rUpdate, 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.c omwrote:
            >>
            >>>>evenlater wrote:
            >>
            >>>>>My db allows the user to send email via CDO. The body of the email is
            >>>>>determin ed 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!txtBo dy) then
            >>> If Right$(Me!txtBo dy,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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
            >>>>Wm5g0/Np9BmoCj4OyS35D 68d
            >>>>=GriS
            >>>>-----END PGP SIGNATURE-----
            >
            >

            Comment

            • evenlater

              #7
              Re: carriage return in a text box

              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.c omwrote:
              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
              EnterKeyBehavio r 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.c omwrote:
              >
              >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_After Update, 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.c omwrote:
              >
              >>>evenlater wrote:
              >
              >>>>My db allows the user to send email via CDO. The body of the email is
              >>>>determine d 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!txtBo dy) then
              >>   If Right$(Me!txtBo dy,2) <vbCrLf Then
              >>     Me!txtBody = Me!txtBody & vbCrLf
              >>   End If
              >> End If
              >
              >>>--
              >>>MGFoster:::m gf00 <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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
              >>>Wm5g0/Np9BmoCj4OyS35D 68d
              >>>=GriS
              >>>-----END PGP SIGNATURE-----

              Comment

              • Salad

                #8
                Re: carriage return in a text box

                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 EnterKeyBehavio r allowing NewLine.


                >
                On Sep 17, 2:34 pm, Salad <o...@vinegar.c omwrote:
                >
                >>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
                >>EnterKeyBehav ior 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.c omwrote:
                >>
                >>>>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_Af terUpdate, 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.c omwrote:
                >>
                >>>>>>evenlat er wrote:
                >>
                >>>>>>>My db allows the user to send email via CDO. The body of the email is
                >>>>>>>determin ed 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
                >>>>>>>includ e 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!txtBo dy) then
                >>>>> If Right$(Me!txtBo dy,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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
                >>>>>>Wm5g0/Np9BmoCj4OyS35D 68d
                >>>>>>=GriS
                >>>>>>-----END PGP SIGNATURE-----
                >
                >

                Comment

                • evenlater

                  #9
                  Re: carriage return in a text box

                  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.c omwrote:
                  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 EnterKeyBehavio r allowing NewLine.
                  >
                  >
                  >
                  On Sep 17, 2:34 pm, Salad <o...@vinegar.c omwrote:
                  >
                  >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
                  >EnterKeyBehavi or 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.c omwrote:
                  >
                  >>>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_Aft erUpdate, 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.c omwrote:
                  >
                  >>>>>evenlate r wrote:
                  >
                  >>>>>>My db allows the user to send email via CDO. The body of the emailis
                  >>>>>>determine d 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!txtBo dy) then
                  >>>>  If Right$(Me!txtBo dy,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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
                  >>>>>Wm5g0/Np9BmoCj4OyS35D 68d
                  >>>>>=GriS
                  >>>>>-----END PGP SIGNATURE-----

                  Comment

                  • Salad

                    #10
                    Re: carriage return in a text box

                    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.c omwrote:
                    >
                    >>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 EnterKeyBehavio r allowing NewLine.
                    >>
                    >>
                    >>
                    >>
                    >>>On Sep 17, 2:34 pm, Salad <o...@vinegar.c omwrote:
                    >>
                    >>>>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
                    >>>>EnterKeyBeh avior 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.c omwrote:
                    >>
                    >>>>>>evenlat er 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
                    >>>>>>>instan t 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.c omwrote:
                    >>
                    >>>>>>>>evenlat er wrote:
                    >>
                    >>>>>>>>>My db allows the user to send email via CDO. The body of the email is
                    >>>>>>>>>determ ined in code. I have built an email form with To, CC and Subject
                    >>>>>>>>>line s 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
                    >>>>>>>>>includ e 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!txtBo dy) then
                    >>>>>>> If Right$(Me!txtBo dy,2) <vbCrLf Then
                    >>>>>>> Me!txtBody = Me!txtBody & vbCrLf
                    >>>>>>> End If
                    >>>>>>>>End If
                    >>
                    >>>>>>>>--
                    >>>>>>>>MGFoste r:::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/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
                    >>>>>>>>Wm5g0/Np9BmoCj4OyS35D 68d
                    >>>>>>>>=GriS
                    >>>>>>>>-----END PGP SIGNATURE-----
                    >
                    >

                    Comment

                    • evenlater

                      #11
                      Re: carriage return in a text box

                      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.c omwrote:
                      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.c omwrote:
                      >
                      >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 EnterKeyBehavio r allowing NewLine.
                      >
                      >>On Sep 17, 2:34 pm, Salad <o...@vinegar.c omwrote:
                      >
                      >>>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
                      >>>EnterKeyBeha vior 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.c omwrote:
                      >
                      >>>>>evenlate r 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_A fterUpdate, 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.c omwrote:
                      >
                      >>>>>>>evenlate r wrote:
                      >
                      >>>>>>>>My db allows the user to send email via CDO. The body of the email is
                      >>>>>>>>determi ned 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
                      >>>>>>>>inclu de 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!txtBo dy) then
                      >>>>>> If Right$(Me!txtBo dy,2) <vbCrLf Then
                      >>>>>>   Me!txtBody = Me!txtBody & vbCrLf
                      >>>>>> End If
                      >>>>>>>End If
                      >
                      >>>>>>>--
                      >>>>>>>MGFoster :::mgf00 <atearthlink <decimal-pointnet
                      >>>>>>>Oaklan d, CA (USA)
                      >>>>>>>** Respond only to this newsgroup.  I DO NOT respond to emails **
                      >
                      >>>>>>>-----BEGIN PGP SIGNATURE-----
                      >>>>>>>Versio n: PGP for Personal Privacy 5.0
                      >>>>>>>Charse t: noconv
                      >
                      >>>>>>>iQA/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
                      >>>>>>>Wm5g0/Np9BmoCj4OyS35D 68d
                      >>>>>>>=GriS
                      >>>>>>>-----END PGP SIGNATURE-----

                      Comment

                      • Salad

                        #12
                        Re: carriage return in a text box

                        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.c omwrote:
                        >
                        >>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.c omwrote:
                        >>
                        >>>>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
                        >>>>differenc e. Mine is a straight forward text box, no bells or whistles,
                        >>>>with the EnterKeyBehavio r allowing NewLine.
                        >>
                        >>>>>On Sep 17, 2:34 pm, Salad <o...@vinegar.c omwrote:
                        >>
                        >>>>>>evenlat er 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
                        >>>>>>EnterKeyB ehavior 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.c omwrote:
                        >>
                        >>>>>>>>evenlat er 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
                        >>>>>>>>>txtBod y_AfterUpdate, so the carriage returns wouldn't be added until
                        >>>>>>>>>the user edited the text box. I want the carriage returns there the
                        >>>>>>>>>instan t the form opens.
                        >>
                        >>>>>>>>Can't you just call the AfterUpdate event in the OnLoad sub?
                        >>
                        >>>>>>>>Me.Tx t = Me.Txt & vbNewLine
                        >>>>>>>>Call Txt_AfterUpdate
                        >>
                        >>>>>>>>>On Sep 16, 11:41 pm, MGFoster <m...@privacy.c omwrote:
                        >>
                        >>>>>>>>>>evenl ater wrote:
                        >>
                        >>>>>>>>>>>My db allows the user to send email via CDO. The body of the email is
                        >>>>>>>>>>>dete rmined in code. I have built an email form with To, CC and Subject
                        >>>>>>>>>>>line s and a large text box for the body of the message so the user can
                        >>>>>>>>>>>ed it the default email message body before sending the message.
                        >>
                        >>>>>>>>>>>Bu t when I populate the large text box (txtBody), I can't get it to
                        >>>>>>>>>>>incl ude the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10)
                        >>>>>>>>>>>an d Chr(13). I've got the Text Format set to "Rich Text" and the Enter
                        >>>>>>>>>>>Ke y Behavior to "New Line in Field". Doesn't help.
                        >>
                        >>>>>>>>>>>Is it possible to populate a text box in Access with VBA so that it
                        >>>>>>>>>>>wi ll include carriage returns?
                        >>
                        >>>>>>>>>>-----BEGIN PGP SIGNED MESSAGE-----
                        >>>>>>>>>>Has h: SHA1
                        >>
                        >>>>>>>>>>Use the TextBox's After Update event procedure to add the vbCrLf:
                        >>
                        >>>>>>>>>>If Not IsNull(Me!txtBo dy) then
                        >>>>>>>>>If Right$(Me!txtBo dy,2) <vbCrLf Then
                        >>>>>>>>> Me!txtBody = Me!txtBody & vbCrLf
                        >>>>>>>>>End If
                        >>>>>>>>>>End If
                        >>
                        >>>>>>>>>>--
                        >>>>>>>>>>MGFos ter:::mgf00 <atearthlink <decimal-pointnet
                        >>>>>>>>>>Oakla nd, CA (USA)
                        >>>>>>>>>>** Respond only to this newsgroup. I DO NOT respond to emails **
                        >>
                        >>>>>>>>>>-----BEGIN PGP SIGNATURE-----
                        >>>>>>>>>>Versi on: PGP for Personal Privacy 5.0
                        >>>>>>>>>>Chars et: noconv
                        >>
                        >>>>>>>>>>iQA/AwUBSNCKaIechKq OuFEgEQIfyACcC2 UZ7b1pKkHg26Wxj AAc0A7GexsAnjDX
                        >>>>>>>>>>Wm5 g0/Np9BmoCj4OyS35D 68d
                        >>>>>>>>>>=Gr iS
                        >>>>>>>>>>-----END PGP SIGNATURE-----
                        >
                        >

                        Comment

                        Working...