make parameter query finding like values

  • Thread starter Thread starter Guest
  • Start date Start date
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:]));
 
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]...
 
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:]));
 
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:]));
 
Back
Top