Query to find field containing certain characters

kdirvin

Registered User.
Local time
Today, 06:29
Joined
Feb 13, 2011
Messages
41
Hi,
I am using Access 2007 and need to create a query that returns projects containing “BT” in their Project ID field. The Project ID has a set format. How would I construct the query to return all of the following Project IDs?

TG-BT-01
JJ-BT-09
HGF-BT-12

The dashes and the varying number of letters before the dash threw me for a loop in properly writing the “Like” criteria.
Thank you!
 
Try a criteria of

Like "*BT*"
 
Thanks for the quick response!

I apologize profusely, I omitted a crucial piece of information. In additional to the project IDs formats that I provided in my earlier post, as follows:

TG-BT-01
JJ-BT-09
HGF-BT-12


Two of my project IDs look like this:

BTT-12-10
BTT-50-06

And I do not want these two containing "BTT" returned in such a query, only the projects containing the "BT".



Is there a way to write a criteria where only projects containing exactly BT would return?

Thank you again!
 
Like "*BT*" AND Not Like "BT*"
 
Just fyi, we could also do:

Code:
Like "*[!A-Za-z]BT[!A-Za-z]*"
 

Users who are viewing this thread

Back
Top Bottom