Link to home
Start Free TrialLog in
Avatar of Lapchien
LapchienFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Wildcard on form filter?

How can this code be amended so that the user can filter on wilcards?

DoCmd.OpenForm "frmEngView", , , "[Surname] = '" & txtEngSurname & "'"



Thanks
Lapchien


Avatar of Jonathan Kelly
Jonathan Kelly
Flag of Ireland image

Hi Lapchien ,


try
DoCmd.OpenForm "frmEngView", , , "[Surname] like '" & txtEngSurname & "'"

Avatar of Lapchien

ASKER

Does not work - I alrady tried that - if the full surname is Mearing and I enter mear I get no results returned...

If I add my own * at the end of the filter it works though - do I add it at the end of the code?
SOLUTION
Avatar of Jonathan Kelly
Jonathan Kelly
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Something like that yes - but your example doesn't work :(
:(

ok hold tight. I'll pull some old code.
put the wildcards in
I think Datrias was almost there


DoCmd.OpenForm "frmEngView", , , "[Surname] = '*" & txtEngSurname & "*'"
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RemounM
RemounM

I would try appending asterisks before and after the query part, in the code itself..

DoCmd.OpenForm "frmEngView", , , "[Surname] like '*" & txtEngSurname & "*'"


But then again, that's a completely random thought.. Oh well, try it. ;)