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

Listbox - Impossible Problem

P: n/a
I am trying to change the colors of a value in a list box when the
values are is based on a select query. I only want the value to
change colors, if another value associated with in the query meets the
proper criteria. The code that I have does not work however here is
what i have so far.

If Me.Station01.Column(1) = "UI" Then
Me.Station01.Column(0).Value.IsVisible = False
If Me.Station01.Column(1) = "OOS" Then
Me.Station01.Column(0).Value.ForeColor = vbYellow
If Me.Station01.Column(1) = "UC" Then
Me.Station01.Column(0).Value.ForeColor = vbWhite
If Me.Station01.Column(1) = "D" Then
Me.Station01.Column(0).Value.ForeColor = vbRed
If Me.Station01.Column(1) = "E" Then Me.Station01.Column(0).ForeColor
= vbBlue
If Me.Station01.Column(1) = "A" Then Me.Station01.Column(0).ForeColor
= vbCyan
If Me.Station01.Column(1) = "T" Then Me.Station01.Column(0).ForeColor
= vbMagenta
If Me.Station01.Column(1) = "TA" Then Me.Station01.Column(0).ForeColor
= vbWhite
If Me.Station01.Column(1) = "AOR" Then
Me.Station01.Column(0).ForeColor = vbGreen
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Yes, you are correct that what you want to do is not supported by the Access
List Box. Sorry. There are some solutions for manipulating colors in the UI
at MVP Stephen Lebans' site, http://www.lebans.com. But, I fear that what
you want is even beyond anything he has done.

I suspect you may be able to simulate what you want with an ActiveX grid
control... either one that is included with the Office Developer Edition or
a third-party Control (but be aware that those are not, in Access,
data-bound, so you'll need a good deal of VBA code to populate and manage
it); or, perhaps, with some care and work, using Conditional Formatting
statements in Access 2000 or later, in a continous forms view Form embedded
in a Subform Control.

The last suggestion is probably the easiest for you to test, try, and check
out.

Larry Linson
Microsoft Access MVP

"Mike" <Mi*************@verizon.net> wrote in message
news:22**************************@posting.google.c om...
I am trying to change the colors of a value in a list box when the
values are is based on a select query. I only want the value to
change colors, if another value associated with in the query meets the
proper criteria. The code that I have does not work however here is
what i have so far.

If Me.Station01.Column(1) = "UI" Then
Me.Station01.Column(0).Value.IsVisible = False
If Me.Station01.Column(1) = "OOS" Then
Me.Station01.Column(0).Value.ForeColor = vbYellow
If Me.Station01.Column(1) = "UC" Then
Me.Station01.Column(0).Value.ForeColor = vbWhite
If Me.Station01.Column(1) = "D" Then
Me.Station01.Column(0).Value.ForeColor = vbRed
If Me.Station01.Column(1) = "E" Then Me.Station01.Column(0).ForeColor
= vbBlue
If Me.Station01.Column(1) = "A" Then Me.Station01.Column(0).ForeColor
= vbCyan
If Me.Station01.Column(1) = "T" Then Me.Station01.Column(0).ForeColor
= vbMagenta
If Me.Station01.Column(1) = "TA" Then Me.Station01.Column(0).ForeColor
= vbWhite
If Me.Station01.Column(1) = "AOR" Then
Me.Station01.Column(0).ForeColor = vbGreen

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.