Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when using quickfind 1

Status
Not open for further replies.

mytaurus2000

Technical User
Oct 4, 2006
138
US
I have the following code:

Private Sub QuickFind_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SortName] = '" & Me![QuickFind] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me!QuickFind.Value = ""

End Sub

But when I search with a customer name of O'Brien, I receive an error stating Syntax error (missing operator) in expression.

What does this mean and how do I fix it?
 
Code:
rs.FindFirst "[SortName]='" & Replace(Me![QuickFind], "'", "''") & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PH, wish I could give you more than one star. Why was this occuring?
 
Why was this occuring?
The criteria you used:
[tt][SortName] = 'O[!]'[/!]Brien'[/tt]

The criteria fixed:
[tt][SortName] = 'O[!]''[/!]Brien'[/tt]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top