ComboBox - display values with different background colors (1 Viewer)

Blancorn

Registered User.
Local time
Today, 14:35
Joined
Feb 27, 2016
Messages
30
I would like to ask you really interesting question:

Is it possible to have values in ComboBox displayed with different background?
For example: having list of values from 0 to 500, values grater than 100 are with blue background and all the others with red one?
 

Micron

AWF VIP
Local time
Today, 17:35
Joined
Oct 20, 2018
Messages
3,478
Pretty sure the answer is no. If memory serves, I may have seen this done for listboxes, but then again, the old noodle ain't what she use to be.
You could change the control colour based on selection if that helps.
 

vba_php

Forum Troll
Local time
Today, 16:35
Joined
Oct 6, 2019
Messages
2,880
the question is not whether IF you can do this, but WHY? Is it because your users are bored or want some flashy interface? combo boxes are meant to be boring. there IS a way to produce events behind the KEYPRESS event when typing inside a box like this. which is similar to the ONBLUR() event in HTML.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:35
Joined
May 21, 2018
Messages
8,527
If you absolutely needed to do this you can fake it, but not with a standard combobox.
listview.jpg

That is done with a listview, and unless your VBA is excellent I would recommend bagging it.

This is done with an imageCombo. Did not know it even existed until someone asked a question about it.
imageCombo.jpg
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Today, 17:35
Joined
May 21, 2018
Messages
8,527
Give it a try but do not hold your breath. I find a lot of the old Lebans stuff (all API based) no longer work even if updated to 64bit. If it needs to be updated to 64 bit there are a few people here that are good at that (I am not one of them).
 

HiTechCoach

Well-known member
Local time
Today, 16:35
Joined
Mar 6, 2006
Messages
4,357
The way I get around the limits of the standard combo box is to use a form with the view set to Continuous Forms. This allows the use of alternate row colors and conditional formatting.

I use a button with an arrow pointing up (reverse of the combo box arrow) I call this a pop-up, or <grin>"throw up"</grin>, as opposed to a dropdown. On the button click, a pop up form opens allowing the user to make a selection from the list.
It uses standard/built-in Access objects and limited VBA code.

I started doing this with Access 2000 for large lists in combo boxes to speed up form load time. It also overcomes the row limit a combo box can handle. I can also add additional search/filtering for other fields to make it even faster for the user to find something in a long list.
I also have used a subform in place of a Listbox for the same reasons.
 

vba_php

Forum Troll
Local time
Today, 16:35
Joined
Oct 6, 2019
Messages
2,880
The way I get around the limits of the standard combo box is to use a form with the view set to Continuous Forms. This allows the use of alternate row colors and conditional formatting.
to this point, I have the attached zip file stored in a directory that has a last modified date of 15 years ago. maybe they can get something from this as well. it highlights every other row of a report as a continuous view, like what you've said.
 

Attachments

  • Highlight Every Other Row.zip
    45.2 KB · Views: 205

CJ_London

Super Moderator
Staff member
Local time
Today, 22:35
Joined
Feb 19, 2013
Messages
16,605
I'm with Boyd, I use a form - but rather than conditional formatting I use rich text for colour/font/bold etc
 

HiTechCoach

Well-known member
Local time
Today, 16:35
Joined
Mar 6, 2006
Messages
4,357
I'm with Boyd, I use a form - but rather than conditional formatting I use rich text for colour/font/bold etc

I like your thinking. (y) Great use of the Rich Text feature

I have created a custom message box using Rich Text with great results.

I like your idea to use it Rich Text to format text on a form when conditional formatting is just not enough.

I have Access application with many features, like what I described above, that were built with Access 97/200/2002/2003 that are still in use today with Access 2007 and later.

Time to starting updating and rebuilding ...
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:35
Joined
Feb 19, 2013
Messages
16,605
when conditional formatting is just not enough.
and too slow - when scrolling conditional formatting does not refresh until you stop scrolling. Only thing you can't do with rich text is disable.

I also use the format property to create a check box which is also resizeable and can use faces rather than ticks and crosses - see this link

 

Micron

AWF VIP
Local time
Today, 17:35
Joined
Oct 20, 2018
Messages
3,478
Did anyone consider formatting fore color in the table property instead (not for combos or listboxes, but some of this other stuff that's being mentioned)? Not that you would do this where there are more than 1 or 2 conditions I suppose.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 22:35
Joined
Feb 19, 2013
Messages
16,605
with numbers you have 4 format options as outlined in the link I provided. Dates and text can only have two formats - is not null and is null.

I use it for required fields e.g. for text

@;"Required"

or perhaps

@;[Red]"Enter your name"

The colour options for format are limited and quite vivid, So I might combine with conditional formatting to show grey text when the rule is 'value is null' but tend to only do this on single forms.
 

Users who are viewing this thread

Top Bottom