List Box - Color Change

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that will display a list of pending requests and what I'd like
to do is display the information on "urgent" requests in red and all others
in black text. The way I have handled this in the past is to have two list
boxes one for the urgent and one for all others. Is there another way to do
this? Is it possible to do this on an item by item level within one listbox?
My gut feeling says no but I thought I'd run it by the MVP's to get their
take.

Thanks a million!
 
Sorry, it's not possible using the native ListBox control.
An alternative would be to use a Subform set to Datasheet or Continuous
view and use ConditionalFormatting.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
I'm not aware as to wether or not a specific entry in a listBox or
comboBox can be a different color from the rest - I do not believe that
it is possible. However, if you're displaying records using a continuous
form, you can use CONDITIONAL FORMATING to alter the apearance of the
records. In design mode, right click on a control in the DETAIL section
and select CONDITIONAL FORMATING. Select 'EXPRESSION IS' in the 'FIELD
VALUE, EXPRESSION IS, FIELD HAS FOCUS' combo box. Enter Me.fieldName =
'Urgent' in the box to the right of the drop-down list and then select
the formating for the field (RED, BOLD, etc.). (This assumes that the
field [fieldName] is a bound control on the form which displays the
status of the record.)
 
Stephen and David,

You guys are geniuses. I had gotten as far as the subform solution but could
not find the right event to attach the color change to. I did not know the
conditional formatting option was there. That's more like Excel than Access.
Go figure. You guys have been, as always most helpful.

Thanks Again!
--
Michal Joyce
Project Management IS Analyst
Aflac - Project Management Office


Stephen Lebans said:
Sorry, it's not possible using the native ListBox control.
An alternative would be to use a Subform set to Datasheet or Continuous
view and use ConditionalFormatting.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Hey it's great working for the duck...

I spoke to soon though, you guys are still geniuses but... and it's a big
but...

I'm working with Acces97. Conditional Formatting isn't an option afterall...

I have 2003 on my PC but 99% of my user don't have it. My app is about 40%
complete so I can't justify reworking it in 2003 anyway unless there is some
additional functionality inherit in 2003 that would be useful in the app I'm
building.

I am going to continue trying to see if I can't figure out how to do it
with a list box. In the mean time I guess I'll go back to the two list baox
method I've used in the past.

Thanks again!
 
MJatAflac said:
Hey it's great working for the duck...

I spoke to soon though, you guys are still geniuses but... and it's a
big but...

I'm working with Acces97. Conditional Formatting isn't an option
afterall...

I have 2003 on my PC but 99% of my user don't have it. My app is
about 40% complete so I can't justify reworking it in 2003 anyway
unless there is some additional functionality inherit in 2003 that
would be useful in the app I'm building.

I am going to continue trying to see if I can't figure out how to do
it with a list box. In the mean time I guess I'll go back to the two
list baox method I've used in the past.

One simple option, not as pretty as color highlighting, is to base the
list box on a query that returns a calculated field that does some sort
of text highlighting, along the lines of:

SELECT
RequestID,
IIf(IsUrgent,
"*** " & RequestName & " ***",
RequestName)
As DisplayRequest
FROM Requests;

Or if you use a subform, there are ways to highlight a row without using
Conditional Formatting. I believe Stephen may have some examples of
this on his website. Of course, on a subform you can also just
translate your "urgent" flag into a great big arrow or asterisk or
something.
 
That would certainly work, but I think I might go with the subform option
with a red exclamation point.

Thanks for your help, when I grow up I want to be as smart as the people who
respond to these posts(or at least some of them).

Thanks,
 
MJatAflac said:
That would certainly work, but I think I might go with the subform
option with a red exclamation point.

I've actually used that one myself.
 
BUT, it should be possible to distribute a Run-time Version of 2003.
You're users would be able to design the objects, but they'd be able to
run everything that you design. If they want to design a query for
themselves, they could use the A97 version with linked tables.
 
Back
Top