Lilly
Lilly

Reputation: 233

Syntax error in Search function

I found this search function code and followed the instructions but I'm getting a syntax error stating missing operator in expression and I can't find where the error is. Here is where the error is:

Me.RecordsetClone.FindFirst "dateassigned" _
& Chr(34) & "*" & Me.txtSearch & "*" & Chr(34)

Here's the code:

Dim bkmk As Variant
Dim strField As String
Me.RecordsetClone.MoveFirst

Me.RecordsetClone.FindFirst "dateassigned" _
& Chr(34) & "*" & Me.txtSearch & "*" & Chr(34)

If Me.RecordsetClone.NoMatch Then
    MsgBox "No Match"
Else
    bkmk = Me.RecordsetClone.Bookmark
    Me.Recordset.Bookmark = bkmk
End If

Thanks!

Upvotes: 0

Views: 111

Answers (1)

kismert
kismert

Reputation: 1692

Your line here needs to read:

Me.RecordsetClone.FindFirst "dateassigned LIKE " _
& Chr(34) & "*" & Me.txtSearch & "*" & Chr(34)

You have to include your comparison opereator (LIKE), and some extra spaces for your find to work.

Upvotes: 1

Related Questions