Like Operator help

  • Thread starter Thread starter Chad
  • Start date Start date
C

Chad

I am haveing a problem getting my Like Operator to work
for a certain query.

I want to return Everything from tblROSTER where the field
Lst_Nme is Like Forms!frmEmp_Status!txtLst_Nme. This is
the code that I have that is not returning any value:

SELECT *
FROM tblROSTER
WHERE tblROSTER.[Lst_Nme] Like "*Forms!frmEmp_Status!
txtLst_Nme*";

Can someone please tell me what I am doing wrong?

Thanks,
Chad
 
You might try:

SELECT *
FROM tblROSTER
WHERE tblROSTER.[Lst_Nme] Like "*" & Forms!frmEmp_Status!txtLst_Nme & "*";

Your original query will treat "Forms!frmEmp_Status!txtLst_Nme" as literal
text -- for example, in the same way as "Smith" in Like "*Smith*".
 
Like "*"+Forms!frmEmp_Status!txtLst_Nme+"*"
putting quotes around the field name makes it text, not a
field name.
 
Back
Top