Results 1 to 9 of 9
  1. #1
    jrm is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    5

    Change background color in field


    I have a report with a comments field and I want to have that comments field change color whenever a "keyword" is put into the comments. Thanks in advance.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I'd suggested you're looki at conditional formatting.
    https://www.techonthenet.com/access/...nd_format2.php
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    jrm is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    5
    I tried that and It only highlights after I click on the field. How would I get it do it as soon as the report is created?

  4. #4
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Why do you click on a report? It is a report and not a form, right?
    Open the report in design view, select the Comments text box, go to Format\Conditional Formatting and add a new rule:

    Expression Is (do not choose Field Value Is unless the "keyword" takes the entire Comments field) InStr([Comments],"Keyword")>0 (adjust to fit your needs) and set the background color. It should work when you open the report.
    Click image for larger version. 

Name:	Capt.PNG 
Views:	19 
Size:	59.3 KB 
ID:	43721Click image for larger version. 

Name:	Capt.PNG 
Views:	18 
Size:	22.9 KB 
ID:	43722

    Cheers,
    Vlad
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    jrm is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    5
    Thanks Vlad, but what does 'Unit' come from?

  6. #6
    jrm is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    5
    Say the field I was searching is called 'Comment' and the word I was searching for was 'delay'. The expression would be InStr([Comment],"delay")>0 ???Is that correct?

  7. #7
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Yes, unit was just an example

  8. #8
    jrm is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Dec 2020
    Posts
    5
    I had to change the background style to normal on the field's properties and now it is working correctly. Thanks for your help!

  9. #9
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    Glad to hear, good luck with your project!
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 6
    Last Post: 06-08-2020, 01:54 PM
  2. Replies: 5
    Last Post: 08-25-2018, 04:55 PM
  3. Change Text color and/or background color
    By Thompyt in forum Reports
    Replies: 2
    Last Post: 02-23-2017, 07:08 PM
  4. Replies: 7
    Last Post: 06-26-2014, 01:41 PM
  5. Change Row Background Color Programmatically
    By sales@4bco.com in forum Programming
    Replies: 2
    Last Post: 10-25-2009, 11:17 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