Results 1 to 12 of 12
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085

    Combo Box Background


    Is it possible on a combo box to change the background color based on the values? I have a combo box that pulls it's choices from a table. In the table there are 3 fields (Classid, Classdesc, Status)
    The form the combo box is on is based on another table that has a table to link to the choices in the combo box ClassID is the field to link. The combo box does not display that field it displays the description for the user to select. However those choices vary as some were canceled from last year and others added this year. We still want to track the history but I want to differentiate the possibilities in the combo box by changing the background colors for those that are active versus those that are inactive. Any thoughts how I can do that?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    not possible with the combo, one of the trade offs against using java/.net etc where you build the combo from scratch (hence longer development times).

    you can create your own combo using a textbox, button and subform for the three main components, then the subform can use conditional formatting.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Stephen Lebans has done some work in this area in which you might be interested: http://www.lebans.com/List_Combo.htm

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,938
    Quote Originally Posted by RuralGuy View Post
    Stephen Lebans has done some work in this area in which you might be interested: http://www.lebans.com/List_Combo.htm
    I've visited his site many times, never saw that one, will have to investigate!

  5. #5
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    A combo box has a background color property. Why can't one alter that value based on selection? What am I missing here?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    I'm with Micron on this one - Combobox Control background works great for Ac2000 and Ac2013.

    Ray, is your control actually a ListBox Control? ListBox Controls cannot have a background color with native Access, thus RuralGuy's suggestion.

  7. #7
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    JWhite no the control is a combobox. Not sure I explained it correctly. I have an Access 2010 Front End with A SQL Server 2008 R2 Back End. The database is a combination of Data from 4 other Databases that include Potential members and Members. So there is Specific Data in there for each Person Also there are tables for each of the departments for the specific data each requires. The purpose of combining the database was so all Departments could see what the status was for each person not only for their department but the others. One of those departments is Health Education which includes classes for Cardiac Patients, COPD Patients and Diabetic Patients. So the structure of the form is the main form links to the person Data with a tab control and tabs for each individual department for their specific data. The Health Education Form includes 2 Subforms 1 for the Diabetic Patients so we can track their A1C results and the 2nd so we can track which classes they attended. The classes subform is a datasheet with shows the date they attended and the class they attended. The class Attended is the combo box I'm having an issue with. The table used includes 4 fields ClassAttendedID Autonumber Primary key, DateAttended Date Field, ClassID Foreign Key to identify which class and PersonID Foreign Key to person table

    Everything works it's just that when the user clicks on the combo box the list comes up showing all of the classes I'd like it to be easier for them to see which are the Active classes and which are the Inactive ones.

    So I'm not talking about the background of the combobox itself I'm talking about the background of each choice and I'm coming to the conclusion I'm out of luck there. Thank you to everyone for trying to help.

  8. #8
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Sounds like you want random row colors based on the list item value. That's not possible, AFAIK. About the only thing I can think of that would come close would be a continuous form as a small sub form so that it resembled a list box. Even then, you'd have to have transparent controls with an unbound empty textbox (or maybe label) that was directly underneath, and use conditional formatting on it which is based on the content of the row control. Even then, I think for all that trouble you can expect to get about a maximum of 3 formatting conditions. Not sure I'm recalling correctly that this is possible with continuous forms, given that each instance of a repeated control is really one one control. Maybe the control should have some sort of additional field with a symbol or other value that denotes the row values.

  9. #9
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    What identifies each Class as being Active vs. InActive? I presume a field? If so, you can include that field in the drop-down list to the left or right of the Class value. Show as A / N/A or 1 / 0 or whatever they would understand. Then you wouldn't need colorization of the dropdown list. Just add it to the rowsource and increment the column count by 1 and adjust the column widths as desired.

  10. #10
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,085
    Thank you all. JWhite that's what I ended up doing. Micron I was hopeful but What I ended up with is there are now 3 columns in the combo box one shows if it's current or History based on the date. Thanks for your help

  11. #11
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Congrats on the resolution! We are glad to have helped.

  12. #12
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,424
    Well, it seems that the solution parallels my last sentence of my last post. Glad you solved it.

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

Similar Threads

  1. Setting background color of combo box
    By Access_Novice in forum Forms
    Replies: 14
    Last Post: 01-07-2015, 08:19 AM
  2. Printing on a .png Background
    By EddieN1 in forum Reports
    Replies: 5
    Last Post: 12-04-2014, 10:40 AM
  3. How to put a background on a form
    By Andrias14 in forum Forms
    Replies: 4
    Last Post: 11-22-2011, 01:40 PM
  4. Run DB in Background
    By jgelpi16 in forum Access
    Replies: 1
    Last Post: 07-27-2010, 01:50 PM
  5. background
    By marianne in forum Access
    Replies: 23
    Last Post: 05-03-2009, 02:10 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