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?
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?