Question : Search string with wildcards in FindFirst property

I created a custom search on a subform where the textboxes are not enabled and locked, so it will select the record. I am having a hard time using LIKE with wildcards. If I type the full name instead of the variable it works. I want it to find what I type in whichever area of the field.

I have changed the percentage sign with asterisk and it doesn't work.

Without the wildcard, if I enter the full correct word and it does work. The problem lies in the wildcard.

I have even tried using ALike and get the same result.

I am on Access 2007, but the file format is 2000 with the back end running on SQL Server 2005.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Dim strCriteria As String
Dim rst As DAO.Recordset
Dim strSearch As String
 
strSearch = InputBox("Search")
 
Set rst = Me.RecordsetClone
strCriteria = "[Word] Like '%" & strSearch & "%'"
rst.FindFirst strCriteria
 
Me.Bookmark = rst.Bookmark

Answer : Search string with wildcards in FindFirst property

try this:
          strCriteria = "[Word] Like '%' & strSearch & '%' "

        I believe T-SQL uses a single quote delimiter.
Random Solutions  
 
programming4us programming4us