Results 1 to 2 of 2
  1. #1
    Ekhart is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jun 2016
    Posts
    80

    Taking value from Rich Text box


    I have a program that takes a bunch of data from a form and inputs it to a third party program. On this form there is a rich text box that compiles a list of comments and enters them in the comments field. They are displayed as:

    Comment 1
    Comment 2
    Comment 3
    Comment 4

    and so on so forth (obviously with actual comments in). These comments are compiled via checkboxes the user selects and I have code that adds these in using </br> to keep adding the comments on new lines. This looks great in the text box but later when VBA grabs the data it shows the </br> again so instead of putting the value in like above it enters it like:
    Comment 1 </br> Comment 2 </br> Comment 3 </br> Comment 4

    If I manually hightlight and copy the text from the text box and paste it in the program it works fine. Basically, is there a way to get just the VALUE of a field using VBA?
    I usually test these with msgbox's so the code I am testing with is:
    Code:
    MsgBox Forms!frmTestForm.Form!ConsultAddComment
    I have also tried adding a .value to the end with no success, it keeps showing the </br>'s.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try Replace() function.

    Replace([fieldname], "</br>", Chr(13) & Chr(10))

    or

    Replace([fieldname], "</br>", "; ")

    Why use rich text? If this one code is the only reason you use rich text, consider, vbCrLf in concatenation instead of </br>.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Rich text field not displaying rich text properly
    By CodeLiftSleep in forum Access
    Replies: 4
    Last Post: 01-24-2018, 10:59 AM
  2. Replies: 3
    Last Post: 06-04-2017, 01:02 PM
  3. Replies: 4
    Last Post: 08-07-2015, 07:49 AM
  4. Rich text - text color and size
    By Subs in forum Reports
    Replies: 3
    Last Post: 11-08-2013, 10:36 AM
  5. Replies: 1
    Last Post: 05-24-2012, 04:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums