Conditional formatting of combo box entries (1 Viewer)

kevlray

Registered User.
Local time
Today, 15:58
Joined
Apr 5, 2010
Messages
1,046
I suspect this is not possible. But I give it a try. Clients want entries of a combo box to be conditionally formatted. I have looked around the internet and not seen anything. So the conditional format would be in the form of, IsNull(( [TermDate] ) = False, then set the text to red. So when the users click on the down arrow, they can spot staff that have a TermDate.

Thanks ahead of time.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:58
Joined
Oct 29, 2018
Messages
21,474
Is the dropdown showing the TermDate or something else?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:58
Joined
May 7, 2009
Messages
19,245
conditional format applies to Each record (each combo) on the form and not on Each List Items on the combo.
 

Mike Krailo

Well-known member
Local time
Today, 18:58
Joined
Mar 28, 2020
Messages
1,044
I don't think that is possible to change the text color of some entries and not others in a combo box.

The other thing that comes to mind is sorting all those staff members with a TermDate to the bottom.

I've also seen combos that have names or products flagged as obsolete or disabled so the user knows that item cannot be selected but is there because records have previously used those list items.

There can be another calculated field in the combo list that simply displays a star designating a staff member having a TermDate. That would effectively que users as desired.
 

monheimx9

New member
Local time
Tomorrow, 00:58
Joined
Aug 18, 2022
Messages
28
I've never seen conditional formatting in a combobox, but I saw something on the Denver Area Access User Group, on a video you can maybe find something interesting about a technique to use flags for a combobox
This video is a great example of what you could do with comboboxes
 

kevlray

Registered User.
Local time
Today, 15:58
Joined
Apr 5, 2010
Messages
1,046
The values are the employee name, but they want the entries highlighted red if the condition stated above is true. My initial efforts did not work the way I expected. Once I selected a value then it would return the result in the combo box with the formatting applied.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:58
Joined
Oct 29, 2018
Messages
21,474
The values are the employee name, but they want the entries highlighted red if the condition stated above is true. My initial efforts did not work the way I expected. Once I selected a value then it would return the result in the combo box with the formatting applied.
Perhaps you can use a floating subform then. You hide and show the subform as a dropdown instead of the Combobox.
 

kevlray

Registered User.
Local time
Today, 15:58
Joined
Apr 5, 2010
Messages
1,046
Interesting video. I will have to see if a way I can use that first tip for my purposes. The sad part is that our programmers have developed a web based version of this application a couple of years ago. But acceptance by the department has been delayed (I do not know why). Of course it would be easy to implement using CSS.
 

kevlray

Registered User.
Local time
Today, 15:58
Joined
Apr 5, 2010
Messages
1,046
I made a change to the combo box and waiting for the client to see if it will work for them. Thanks for the info.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 23:58
Joined
Sep 12, 2006
Messages
15,658
The values in a combo box are text, (not numeric) but I imagine that access would need to treat the text as rich text, so you could embed HTML codes in the text, as happens with rich text fields. Of course then when the combo box returns data it would need to remove the display tags, and that's probable the tricky part.

But then generally the contents of the combobox are derived from a query, not a text string, so now you need a way to pretty-format the data returned by the query. Maybe it's more doable with a text rowsource rather than a query rowsource, but it will still be fiddly.

So something for the future ... if MS ever decide to "improve" access again.
 

Users who are viewing this thread

Top Bottom