You need to change the single apostrophe to double. Something like this:
Code:Private Sub Command_Click() Dim SQLSearchString As String Dim strLastName As String strSQL = "select * from refuserinfo" rsTempRecordset.Open strSQL, cnRate, adOpenStatic, adLockReadOnly strLastName = "o'price" SQLSearchString = " lastname = '" & Replace(strLastName, "'", "''") & "'" If Not rsTempRecordset.EOF Then rsTempRecordset.Find SQLSearchString, , adSearchForward If rsTempRecordsetEOF Then MsgBox "No Records Found... Try Again" Else MsgBox "Records Found" End If End If End Sub




Reply With Quote