By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

Setting background colour in list box

P: 5
Is there any way that I can setup the equivalent of Excel Conditional formatting in an Access list box form control?

What I need to do is populate a list box from query by looping through the query dataset but I want to set the background colour of the column dependant on the contents of the column.

Any help greatly appreciated.
Oct 30 '06 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Is there any way that I can setup the equivalent of Excel Conditional formatting in an Access list box form control?

What I need to do is populate a list box from query by looping through the query dataset but I want to set the background colour of the column dependant on the contents of the column.

Any help greatly appreciated.
Conditional formating in access is very limited and is only available on textboxes not on listboxes I'm afraid. Outside of setting column width and listbox dimensions I'm afraid there is no formating available on listboxes conditional or otherwise.
Oct 30 '06 #2

Expert 5K+
P: 8,434
Conditional formating in access is very limited and is only available on textboxes not on listboxes I'm afraid. Outside of setting column width and listbox dimensions I'm afraid there is no formating available on listboxes conditional or otherwise.
Just a stab in the dark - perhaps you could do it by subclassing? Haven't thought about that in years, but I recall it being used to put colours and images in pull-down menus, and lots of similar things. This was in VB6 or earlier, but I imagine one could do something similar in Access VB.
Oct 30 '06 #3

Expert 5K+
P: 8,434
Sorry, can I just get some clarification?

Are we talking about changing the colour of the whole list, or of individual entries? For the whole list, the BackColor property should allow you to do what you like, via a macro (I assume) or VB procedure. For individual entries, subclassing might allow you to do it, but I was never really familiar with the area.

None of this really applies, of course, if you must have exactly the type of automatic functionality provided by Excel's conditional formatting. But an event procedure running your code may provide the next best thing.

If you want to be able to set it up from just the control parameters, perhaps you could store values in the Tag property to indicate the functionality to be performed, and invoke a generic routine which works for any listbox.
Oct 30 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.