Querying a string contained within a larger string

spk

New member
Local time
Today, 16:46
Joined
Aug 2, 2007
Messages
6
Hello all,
I'm familiar with access or was a few years ago and have recently encountered a situation that I cannot remember how to solve.
I have setup a very basic database for a company that lists all of their orders within one table. There are fields for customer name, PO number, Part Number, material, date, and cost. I created two queries; one to search by Part Number and another to search by PO number. Each query begins with a prompt that says: "Please enter the Part Number" or "Please enter the PO Number" and a field to enter the number one is searching for. It then displays matching results in a table.
I was recently asked if it's possible to amend the Part Number query to include all instances of a string, including those that occur within a larger string.
For instance, when one fills in 56789 in the search field, results such as 0123456789 and 222-56789 and 56789Rev.1 are included as well as plain old 56789.
I thought that queries searched this way by default, but when I tested this theory the larger strings that contained the small string I was looking for were not shown in the results.
I suspect that I either incorrectly tested the above theory or that there is a pretty simple solution to this problem. Any help very much appreciated.
Regards,
-Shawn
 
Your query criteria would need to be

Like "*" & [Please enter the Part Number] & "*"

And if text

Like "'*" & [Please enter the Part Number] & "*'"
 
Thanks so very much for your help! I have not yet had an opportunity to try this out but based on the other great help I've gotten here in the past, I'm sure it will work. Thanks again!
 

Users who are viewing this thread

Back
Top Bottom