• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 690
  • Last Modified:

Search Button for Memo Field, overflow error

Experts,

I get this overflow error sometimes in the code below.  
The search term is actually contained in the memo field but it returns the error (attached).  

this is a follow up to a question:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_26481808.html

How can I get rid of the error? (note that the search term is in the memo field but still gives error...sometimes though).  

Maybe someone can give me different code options for this search in a memo field that is rich text.  It doesnt seem to be very predictable and doesnt pinpoint the item found.  It si usually way off and highlights another term and not the search term.  If I change the setting from rich text to plain text then it works fine and search term is pinpointed exactly.
thanks..

Private Sub cmdFindWord_Click()

  sWord = InputBox("Type word to find")
If Len(Trim(sWord)) > 0 Then

    sNote = Me.txtNotes
   
    'j = InStr(sNote, sWord)
    j = InStr(PlainText(sNote), sWord)
   
End If
If j <> 0 Then
   
    Me.txtNotes.SetFocus
    Me.txtNotes.SelStart = j - 1
    Me.txtNotes.SelLength = Len(sWord)
    Else
    MsgBox "Word " & Chr(34) & sWord & Chr(34) & " not found!", vbQuestion, "WORD SEARCH"
End If



End Sub

Open in new window



overflowerror
0
pdvsa
Asked:
pdvsa
  • 2
  • 2
1 Solution
 
Jeffrey CoachmanMIS LiasonCommented:
0
 
pdvsaProject financeAuthor Commented:
That is pretty nice looking form.  
It did say:
Limitations
The sample database is concept-only. You will need to develop it further to use it with:
"Memo fields where rich text is stored (tags may clash);"

The field i am searching is Memo ppty.
It seems as though it highlights but i dont think that will help me as i need the cursor to go directly to the search term and i need a "next" button to find the next occurrence.

What do you think now?  Thank you
0
 
Jeffrey CoachmanMIS LiasonCommented:
Without a sample, I am a bit lost.

<i need a "next" button to find the next occurrence.>
In a broad sense, you would load a table with all your "search" terms.
Then create a recordset from this table
Then loop this table each time you clicked you "Next" button
....
rst.movenext
'Your Highlight Code

Make sense?

But again, it seems we need to address the error in your original question first...
For that, a sample would be very useful.
(you know the drill...)
0
 
pdvsaProject financeAuthor Commented:
I will have to revisit again...thanks.  It is not that important at the moment.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now