How do you bold a portion of text entered into an unbound text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Heather Thurber
    New Member
    • Jul 2010
    • 4

    How do you bold a portion of text entered into an unbound text box

    I am using the following code in Access 2007

    Me.strNotes = "" & DateNow & ", " & strPOEmpID & ":" & Space(1) & "" & Me.strPONotes & "" & vbNewLine & Me.strNotes

    I want the "" & DateNow & ", " & strPOEmpID & ":" to be bolded when passed into the strNotes field. I've tried changing the text boxes to rich text formatting but have been unable to figure out how to make this work.

    The field will have multiple entries added over time and I want date and employee id bolded on each entry.

    FYI - I am not able to download a rich text program due to network permissions.
  • Delerna
    Recognized Expert Top Contributor
    • Jan 2008
    • 1134

    #2
    I don't use 2007 but a serch with google found this piece of sql code for a field to be displayed in an rtf textbox
    Code:
    =IIf([CompanyName] Is Null, Null, Replace([CompanyName], "ar", "<font color=""red"">ar</font>"))
    and this

    Code:
    =Replace([CompanyName], "ar", "<b>ar</b>"))
    Which suggests to me that you just use standard html syntax.


    so have you tried this?
    [code=vba]
    Me.strNotes = "<b>" & DateNow & "</b>, " & strPOEmpID & ":" & Space(1) & "" & Me.strPONotes & "" & vbNewLine & Me.strNotes
    [/code]

    Comment

    • patjones
      Recognized Expert Contributor
      • Jun 2007
      • 931

      #3
      You don't need to download a rich text program. When you create a text box you can use the Property Sheet > Data > Text Format property to set the box to Rich Text. Or in VBA:

      Code:
      Me.strNotes.TextFormat = acTextFormatHTMLRichText

      At that point Delerna's suggestion works very nicely.

      Pat

      Comment

      • Heather Thurber
        New Member
        • Jul 2010
        • 4

        #4
        Thanks that worked great! I just didn't realize the HTML was supposed to go into the VBA.

        Comment

        Working...