tadhg cashman
asked on
Search any part of a field using an Access Query
Hi All,
I know this question has probably been asked before but I am creating a query that searchs a table from a form for specific data. However the search at present is word specific. What i am looking for is can the query be modified so as if I put greene in the title part of the search it will search through any part of the Title field and return the result.
I have attached my sql code of the query as it stands. There are 7 search fields that I would like to make this change to
I know this question has probably been asked before but I am creating a query that searchs a table from a form for specific data. However the search at present is word specific. What i am looking for is can the query be modified so as if I put greene in the title part of the search it will search through any part of the Title field and return the result.
I have attached my sql code of the query as it stands. There are 7 search fields that I would like to make this change to
SELECT *
FROM [AGO Inventory]
WHERE (Barcode Like [forms]![Search Form]![Barcode] & "*"
OR [forms]![Search Form]![Barcode] Is Null
)
AND ([Customer Number] Like [forms]![Search Form]![Customer Number] & "*"
OR [forms]![Search Form]![Customer Number] Is Null
)
AND (Title Like [forms]![Search Form]![Title] & "*"
OR [forms]![Search Form]![Title] Is Null
)
AND ([Media Type] Like [forms]![Search Form]![Media Typer] & "*"
OR [forms]![Search Form]![Media Type] Is Null
)
AND ([S C] Like [forms]![Search Form]![S C] & "*"
OR [forms]![Search Form]![S Cr] Is Null
)
AND (Keyword Like [forms]![Search Form]![Keyword] & "*"
OR [forms]![Search Form]![Keyword] Is Null
)
AND ([Free Text] Like [forms]![Search Form]![Free Text] & "*"
OR [forms]![Search Form]![Free Text] Is Null
)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Legend. Thanks so much. Cant believe it was that simple and I over looked it. Works perfectly now
If you put * in front as well then it would look for anything that starts with, ends or in between