Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String contantinations in searches 2

Status
Not open for further replies.

nateDiggs

IS-IT--Management
Jul 20, 2005
14
US
hello--

I have a pretty complicated query that I need to run. I have a table containing customer information. In that table there is a column for the customers full name. In a search function I'm designing I want a form to pop up and a user can enter in a last name, a first name, or both first and last name. This will then run the query on the data entered. So what I want to do is something like this:

Select *
From CustomerData
Where (entered first name) + (entered last name) LIKE CustomerData.FullName;

I'm basically trying to concantenate the first and last names entered into the search form. The other issue here is I need to add a space in there and allow for a * to be inserted in there in case a middle initial is present. So baisically I need a concantenated string representing (first name) " "*(last name). That would allow for James C Doe to be in the Full Name field and be searchable by my quiery. Any help is greatly appreciated.
 
Parameters [TheName] Text(255);
Select *
From CustomerData
Where CustomerData.FullName LIKE [TheName] & "*";

 
Code:
SELECT FullName

FROM CustomerData

Where FullName LIKE [Enter First Name]  & '*' &  [Enter Last Name]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top