Select Text

Joshann

Registered User.
Local time
Today, 09:01
Joined
Mar 22, 2002
Messages
142
I have a form (called SearchResults) that displays the results of a search based on text entered by the user in a form called Find. I would like the text entered by the user to be highlighted on each record in the field on the SearchResults form. I know how to do it by clicking a button but can't figure out how to do it automatically when the SearchResults form loads. This is how I can do it by clicking a button. On the SearchResults form, I can put a button called Display. Here is the code for it:

Private Sub Display_Click()
Field1.SetFocus
Field1.SelStart = InStr(Field1,Forms!Find!txtSearchCriteria.Value) - 1
Field1.SelLength = Len(Forms!Find!txtSearchCriteria.Value)
End Sub

Like I said, this will work for one record at a time, but I don't want the user to have to click the button for each record. I want the text to be highlighted on every record when the form loads. Can anyone help?
 
You are using select text (yes it is highlighted) but I think you are limited to one occurance. What you really want I think (I have never done this, just thinking outloud here) is to use a RTB (rich text box) or something where you can manipulate the color/font in a portion of the text. That way you can change the foreground and background colors in the small section of text you wish.
 
O.K. That sounds like a good start, but I have no idea what to do.
 

Users who are viewing this thread

Back
Top Bottom