Results 1 to 5 of 5
  1. #1
    ohmydatabase's Avatar
    ohmydatabase is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2017
    Posts
    79

    Cool RichTextBox Control

    Hi All,

    So I'm trying to make a TextBox Control that I can add 'fancy' styling and margins to. I am querying my database and I'm hoping to systematically add text to this TextBox as I step through my recordset. The end product I'm aiming for is a bulleted list. Headers of each list will be Bold, Underlined, Both, or Plain based on some simple if-else logic. The bulleted list will include bullets and proper margins to force the text to wrap in the correct manner. Sounds great in my head.



    Here are my problems:

    1) I don't how to systematically add text to a TextBox. I understand that you can do something along the lines of
    Me.txtbox.Text = "Header1"
    Me.txtbox.Text = Me.txtbox.Text + vbCrLf
    Me.txtbox.Text = Me.txtbox.Text & " - Bullet 1"
    Me.txtbox.Text = Me.txtbox.Text + vbCrLf
    Me.txtbox.Text = Me.txtbox.Text & " - Bullet 2"

    Using this method if change the style of the text (i.e. Me.txtbox.Font.Bold = True) it will change the entire TextBox since I am importing the characters as one string... I want to control where and what is styled.


    2) I have no clue how to use/write in rtf. If I make one giant string with all the needed rtf "tags" to designate styling or margins can I just set the Me.txtbox.Text = superLongRtfString with the Rich Text property set on this textbox?


    3) I have the feeling that this is the wrong way to pursue this problem and reports might be a better option. However, I know nothing about reports. So I figured I'd ask you guys to see if anyone has a better way to approach this problem.


    Thank you.
    Last edited by ohmydatabase; 04-19-2017 at 05:37 PM. Reason: Add Tages

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    To implement RTF:

    1. set field in table as memo type and set its TextFormat property to Rich Text

    2. bind textbox to field and set its TextFormat property to Rich Text

    3. Use the RTF toolbar

    4. To add RTF formatted text to textbox programmatically, have to use HTML tags that Access recognizes
    Review http://stackoverflow.com/questions/7...l-is-supported

    Access report does not have text formatting capabilities like would be found in Word. Would still have to use the RTF field and textbox and HTML tags.
    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.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    if you go to this link

    https://www.access-programmers.co.uk...d.php?t=290820

    and download the file you can find out what html coding is required for bullet points

    open the form and select home on the ribbon

    In the top section, start a new record (you can expand the row height) and add some bullet points (use ctrl-enter to go to a new line), add colors/bold/alignment whatever as you would like to see it reported

    you will see what the code needs to look like for bullet points in the bottom section when you click off the record

    read the rest of the thread for more information

  4. #4
    ohmydatabase's Avatar
    ohmydatabase is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2017
    Posts
    79
    @June7

    Thanks so much! This revived my hope in using rtf!

    I have a front-end that is distributed among many users each submits their own information to the back-end. I'm trying to give them the ability to see what they've put into the database for a given date range. To do this is I have a form with a disabled textbox that (I'm hoping) will automatically populate the textbox in a neat format (bulleted list). The other option was the report, which I'm also not quite understanding.

  5. #5
    ohmydatabase's Avatar
    ohmydatabase is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Feb 2017
    Posts
    79
    @Ajax

    Thank you again! Great link and I'll give this a good read!

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

Similar Threads

  1. Replies: 3
    Last Post: 11-30-2016, 07:18 PM
  2. Replies: 4
    Last Post: 02-18-2016, 12:06 PM
  3. Autopopulate RichTextBox on form open
    By mdex in forum Forms
    Replies: 2
    Last Post: 10-09-2015, 12:27 AM
  4. Replies: 8
    Last Post: 06-19-2015, 02:19 AM
  5. Replies: 3
    Last Post: 03-29-2012, 12:40 PM

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