I'm trying to open a form and filter the records. However rather than finding all the records that MATCH the search string, I want all the records that CONTAIN the search string. So the obvious thing would be to add an * before and after it. The msgbox proves that that bit is ok.
So if I enter "chair" I expect to get - "chairs", "table and chairs" etc.
But that's where it goes pear shape. Here is my code which is for the button on the first form which has a textbox.
Private Sub CommandProceed_Click()
Dim SearchString As String
SearchString = "*" & Me.TextboxEntry.Value & "*"
DoCmd.OpenForm "Customs Codes Lookup 2", , , "Description like " & SearchString, acFormReadOnly
I get the error message "Syntax error (missing operator) in query expression 'Description like *chair*'.
Do you have complete code. ? I would like to use it for my database ? I am not sure where to place this ? I am new to vba
stLinkCriteria = "[Company_Name]LIKE " & "'" & "*" & Me![txtCriteria] & "*" & "'"