Results 1 to 4 of 4
  1. #1
    Egan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    7

    SQL Statement to Change Background Color of Words in a String

    Hi, in Access 2013 I use a sql statement with html to highlight words in a string stored in a recordset. I’m able to use the code below to find the words in the string and change their font color. Instead of changing font color, I would like to change the words background color, for example to yellow. Is that possible? What would be the html tags to change the background color? TIA


    a = Replace(Myrec("Entry"), c, "<font color=""red""> " + c + " </font>")

  2. #2
    Egan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    7
    By using the highlight menu in a rich text field I was able to find the html syntax for highlighting in yellow the background color of the word to be changed in the sql statement. The code is
    a = Replace(Myrec("Entry"), c, "<font style=""BACKGROUND-COLOR:#FFFF00""> " + c + " </font>")

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Thanks for posting your solution, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Egan is offline Novice
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Posts
    7
    Paul, thanks for the thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 12-02-2011, 11:20 AM
  2. Background Color
    By Meccer in forum Access
    Replies: 4
    Last Post: 05-30-2011, 06:49 AM
  3. Background color for fields in a subform
    By eric.opperman1@gmail.com in forum Forms
    Replies: 3
    Last Post: 03-19-2011, 07:46 PM
  4. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 AM
  5. background color in a form
    By taggart in forum Forms
    Replies: 1
    Last Post: 05-07-2009, 10:37 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