Results 1 to 3 of 3
  1. #1
    BakerMan is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    16

    How can I color code my listbox

    I would like to be able to color code some data that is pulled from my table. If I could make the table data colored and have the listbox output it in color that would be ideal, however, i would just be happy with the listview showing the formatted (colored) text, leaving the table as-is. I have this great database that outputs parts, but I want to make them green (confirmed) yellow (possible) and Red (unsupported). Thank you in advance.



    Click image for larger version. 

Name:	Form.PNG 
Views:	15 
Size:	23.2 KB 
ID:	38406

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    look at the status of the part using a dlookup function (or by looking at a column in your list box) then use the [ControlName].backcolor property to set the background color property of the list box.

    typically I do conditional formatting with RGB(x,y,z) where I figure out the RGB values of what I color I want then substitute them into the function.

    Bear in mind that if your list box returns more than one value and one is 'approved' and one is 'pending' you will get inconsistent results.

    EDIT: or just show the status of the part in the resulting search

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    It is possible to add some colour formatting to both listboxes and combo boxes. However it is very limited and I think unlikely to be what you want.
    See this article on my website for further info. http://www.mendipdatasystems.co.uk/a...our/4594424152

    You can do far more with formatting by using a subform … if you wish the subform appearance can be made to mimic a listbox
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 3
    Last Post: 12-03-2018, 05:22 AM
  2. Replies: 3
    Last Post: 03-19-2017, 09:18 PM
  3. Replies: 1
    Last Post: 12-15-2013, 08:10 PM
  4. The Color Palette and Dynamic use in VBA code.
    By casinc815 in forum Programming
    Replies: 3
    Last Post: 11-19-2013, 09:37 AM
  5. Color Code Query Results
    By jo15765 in forum Queries
    Replies: 6
    Last Post: 01-10-2013, 09:13 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