Not surprising. You are using single quotes (= apostrophes = chr(39)) to delimit a string which has an apostrophe in it, which causes an error.
If you know that the text to search for will never contain double-quotes ("), you can use those as delimiters:
strSearch = "Name = " & Chr(34) & Me!txtSearch.Value & Chr(34)
If your search string could contain either single- or double-quotes (but not both), you could do something like this:
Code:
Private Sub txtSearch_AfterUpdate()
'Find record based on contents of txtSearch.
Dim strSearch As String, Delim as string
On Error GoTo errHandler
'Delimited for text search.
Delim = chr(39) ' start with single quote
if instr( Me!txtSearch.Value,"'") <> 0 then
Delim = chr(34) ' Change delimiter to double-quote
endif
strSearch = "Name = " & Delim & Me!txtSearch.Value & Delim
'Delimited for numeric values.
'strSearch = "OrderID = " & Me!txtSearch.Value
'Find the record.
Me.RecordsetClone.FindFirst strSearch
Me.Bookmark = Me.RecordsetClone.Bookmark
Exit Sub
errHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
End Sub