Hi,

I am trying to filter my displayed records by their project name.

Under a button click I have this code:

VB Code:
  1. DoCmd.ApplyFilter , "[ProjectName] Like '*' & '1st floor' & '*'"

and it filters the records to only show ones with '1st floor' in the projectname


BUT I want to be able to change the '1st floor' parameter so I did this...(created a textbox "txtSearch" to type in my variable)

VB Code:
  1. DoCmd.ApplyFilter , "[ProjectName] Like '*' & [txtSearch].Value & '*'"

but this comes up with an "Enter Parameter Value" message box for txtSearch.Value

So I tried this....

VB Code:
  1. Dim tmp As String
  2.     tmp = "*" & txtSearch.Value & "*"
  3.     DoCmd.ApplyFilter , [ProjectName] Like tmp


and it does the same as above except asks for tmp.


How can I write this correctly to find the value I type in the text box on the form??