Partial match on query

S

Shawn

I have a contact management database consisting of a
table of clients (tblClients). I want to Query this
table for the clients address. I want to have the query
on all complete and partial matches. (i.e a query on the
number 19 would return all address with 19 in them; 19,
191, 192, 219, 319 etc.) This query will be based on a
parameter typed by the user in a text box on a form
(frmQueryAddress). What can I use to accomplish this?

Thanks for any help.
Shawn
 
V

Van T. Dinh

Use the Like operator. Sample SQL:

SELECT *
FROM tblClients
WHERE [Address] Like "*19*"

If the Parameter (e.g. 19 above) is in a TextBox, use:

SELECT *
FROM tblClients
WHERE [Address] Like "*" & Forms!YourForm!TextBox & "*"
 
S

Shawn

That worked great, thanks.

Shawn

-----Original Message-----
Use the Like operator. Sample SQL:

SELECT *
FROM tblClients
WHERE [Address] Like "*19*"

If the Parameter (e.g. 19 above) is in a TextBox, use:

SELECT *
FROM tblClients
WHERE [Address] Like "*" & Forms!YourForm!TextBox & "*"


--
HTH
Van T. Dinh
MVP (Access)



I have a contact management database consisting of a
table of clients (tblClients). I want to Query this
table for the clients address. I want to have the query
on all complete and partial matches. (i.e a query on the
number 19 would return all address with 19 in them; 19,
191, 192, 219, 319 etc.) This query will be based on a
parameter typed by the user in a text box on a form
(frmQueryAddress). What can I use to accomplish this?

Thanks for any help.
Shawn


.
 

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