Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I change forecolor to red for records in listbox based on criteria

Status
Not open for further replies.
Jan 14, 2002
143
US
Is this possible? I would like to make all records red in a listbox based on whether a yes/no field is "no." If you know a way, please share!
 
You can change back color for whole list box only.

Me.lstListBox.ForeColor = 0 'Black
Me.lstListBox.ForeColor = 255 'Red

Maybe change list box's label fore color for user warning?

Example:
If list box's third column contains boolean type data i.e yes/no then:

private sub lstListBox_AfterUpdate()
if Me.lstListBox.column(2)="Yes" then
Me.lblListBoxLabelName.ForeColor = 0
else
Me.lblListBoxLabelName.ForeColor = 255
end if
end sub


Aivars [pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top