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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box Color coding

Status
Not open for further replies.

Tommy408

Programmer
Apr 30, 2006
53
US
I want certain data on a large List Box to stand out by highlighting the row or highlighting a specific text. How should I go about doing this? Any related info out there I can look at?
Thank you.
 
I do not think that there is a way to do this with a listbox. Build a subform that works and looks like a listbox. A little formatting can do this. Use on click events to change the value of a field when you click on a row. Now to highlight the current row, this is my approach

Code:
Dim varCurrentID As Long

Private Sub Form_Current()
  varCurrentID = Me.ID
  Me.Recalc
End Sub

Public Function CurrentID() As Variant
  CurrentID = (varCurrentID)
End Function

Private Sub Form_Load()
  varCurrentID = Me.ID
End Sub

I use an unbound control "txtBoxCurrentID" on the form and set its value to

=CurrentID()

Then I use conditional formatting to highlight text boxes where [txtBoxCurrentID] = [ID]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top