Like Operator help

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
 
B

Brian Camire

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*".
 
D

dlw

Like "*"+Forms!frmEmp_Status!txtLst_Nme+"*"
putting quotes around the field name makes it text, not a
field name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top