Hi,
I have used the following code (given by GTO in thread thread222-109634) to highlight searched for text - it works fine. I'd like to be able to highlight (make bold?) all instances of the text found and also more than one string at a time.
**CODE:
Option Explicit
Dim StartPosition
Private Sub cmdFindNext_Click()
StartPosition = InStr(StartPosition + 1, txtSearchIn, txtSearchFor)
If StartPosition <= 0 Then Exit Sub
txtSearchIn.SelStart = StartPosition - 1
txtSearchIn.SelLength = Len(txtSearchFor)
txtSearchIn.SetFocus
End Sub
Private Sub Form_Load()
StartPosition = 0
End Sub
**END OF CODE
We have a tool which allows users to search a text field in a database for particular words or phrases (not neccessarily adjacent to each other) and would like to highlight the words that they searched for in the results text box.
Any clues?
TIA
pmrankine
I have used the following code (given by GTO in thread thread222-109634) to highlight searched for text - it works fine. I'd like to be able to highlight (make bold?) all instances of the text found and also more than one string at a time.
**CODE:
Option Explicit
Dim StartPosition
Private Sub cmdFindNext_Click()
StartPosition = InStr(StartPosition + 1, txtSearchIn, txtSearchFor)
If StartPosition <= 0 Then Exit Sub
txtSearchIn.SelStart = StartPosition - 1
txtSearchIn.SelLength = Len(txtSearchFor)
txtSearchIn.SetFocus
End Sub
Private Sub Form_Load()
StartPosition = 0
End Sub
**END OF CODE
We have a tool which allows users to search a text field in a database for particular words or phrases (not neccessarily adjacent to each other) and would like to highlight the words that they searched for in the results text box.
Any clues?
TIA
pmrankine