Partial match on query

  • Thread starter Thread starter Shawn
  • Start date Start date
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
 
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 & "*"
 
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


.
 
Back
Top