Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 619
  • Last Modified:

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
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

Open in new window

  • 2
1 Solution
You are using wildcards already but looking for something that starts with your text
If you put * in front as well then it would look for anything that starts with, ends or in between

WHERE (Barcode Like   "*" & [forms]![Search Form]![Barcode] & "*"
AGOITAuthor Commented:
Legend. Thanks so much. Cant believe it was that simple and I over looked it. Works perfectly now

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now