Hi,
I am trying to filter my displayed records by their project name.
Under a button click I have this code:
VB Code:
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:
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:
Dim tmp As String tmp = "*" & txtSearch.Value & "*" 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??


Reply With Quote