make parameter query finding like values

G

Guest

Hello.

I'm new to Access. I want to run a Parameter Query to find all records in
table Contacts mathing any one value (any letter of person's first name);
i.e. that when prompted, the letter "j" would find all john, jerome, rajah,
etc. Here's the SQL view. Any help with exact syntax would be appreciated.

SELECT Contacts.FirstName, Contacts.MI, Contacts.LastName, Contacts.Title,
Contacts.Contractor, Contacts.Position, Contacts.Organization,
Contacts.PrimaryPhone, Contacts.Fax, Contacts.[E-mail], Contacts.[Office
City], Contacts.[State (Country)], Contacts.Region, Contacts.Comment
FROM Contacts
WHERE (((Contacts.FirstName) LIKE [Enter partial first name:]));
 
A

Allen Browne

Add the wildcard:
WHERE (((Contacts.FirstName) LIKE [Enter partial first name:] & "*"));

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
G

Guest

That will only find matches that begin the same. I want a matching character
anywhere in the field to be return that record.

Allen Browne said:
Add the wildcard:
WHERE (((Contacts.FirstName) LIKE [Enter partial first name:] & "*"));

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
I'm new to Access. I want to run a Parameter Query to find all records in
table Contacts mathing any one value (any letter of person's first name);
i.e. that when prompted, the letter "j" would find all john, jerome,
rajah,
etc. Here's the SQL view. Any help with exact syntax would be appreciated.

SELECT Contacts.FirstName, Contacts.MI, Contacts.LastName, Contacts.Title,
Contacts.Contractor, Contacts.Position, Contacts.Organization,
Contacts.PrimaryPhone, Contacts.Fax, Contacts.[E-mail], Contacts.[Office
City], Contacts.[State (Country)], Contacts.Region, Contacts.Comment
FROM Contacts
WHERE (((Contacts.FirstName) LIKE [Enter partial first name:]));
 
A

Allen Browne

Add a leading wildcard as well:
WHERE Contacts.FirstName LIKE "*" & [Enter partial first name:] & "*";

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
That will only find matches that begin the same. I want a matching
character
anywhere in the field to be return that record.

Allen Browne said:
Add the wildcard:
WHERE (((Contacts.FirstName) LIKE [Enter partial first name:] & "*"));

in
message
I'm new to Access. I want to run a Parameter Query to find all records
in
table Contacts mathing any one value (any letter of person's first
name);
i.e. that when prompted, the letter "j" would find all john, jerome,
rajah,
etc. Here's the SQL view. Any help with exact syntax would be
appreciated.

SELECT Contacts.FirstName, Contacts.MI, Contacts.LastName,
Contacts.Title,
Contacts.Contractor, Contacts.Position, Contacts.Organization,
Contacts.PrimaryPhone, Contacts.Fax, Contacts.[E-mail],
Contacts.[Office
City], Contacts.[State (Country)], Contacts.Region, Contacts.Comment
FROM Contacts
WHERE (((Contacts.FirstName) LIKE [Enter partial first 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