LIKE function

C

Chad

I posted this in another section and no one was bale to
help me. I've always gotten good responses from this
room so if anyone could help me I would really appreciate
it.

I don't know if I am overlooking something obvious or not
but if anyone could help me I would really appreciate
it. I would like to display records that resemble
criteria entered into a textbox. Access doesn't recognze
the SOUNDEX or % functions and the LIKE function only
allows you to enter values in quotations, so if I enter:

SELECT FName, LName
FROM tblRequest
WHERE FName Like "*Forms!frmSearch!txtFName*"

the query looks for the string "Forms!frmSearch!txtFName"
which of course isn't in my table. My question is if
there is a way to look for records that resembled data
entered into a control on a form. And if so, how to you
specify that in SQL?

Thanks in advance,
Chad
..
 
D

Dan Artuso

Hi,
Try something like this:
SELECT FName, LName
FROM tblRequest
WHERE FName Like '*' & Forms!frmSearch!txtFName & '*'
 
S

seeker22451

Do not know if this will work but try this

dim vbstring as string
vbstring = "select fname, lname from tblRequest where
fname like *" & forms!frmSearch!txtFname & "*"
docmd.runsql (vbstring)
 
F

Fredg

WHERE FName Like "*" & Forms!frmSearch!txtFName & "*"

The form must be open when the query is opened.
 

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