Solved

"Contains" function in MS-Access 2007

Posted on 2013-11-19
3
3,272 Views
Last Modified: 2013-11-19
I am writing a query and I want to find all the records with a field "Name" that contains more than one string; i.e. Name Contains ("XYZ","ABC")

What is the syntax for the Criteria for the field?

Thanks

Glen
0
Comment
Question by:GPSPOW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 500 total points
ID: 39660455
If you are looking for an exact match, you can use the IN keyword:

Name IN ("XYZ", "ABC")

If you are looking for a partial match, you can use the LIKE keyword:

Name LIKE "XYZ*" OR Name LIKE "ABC*"

The star represents a pattern search, so the above would be where name starts with. For an ends with search, put the star at the beginning. For an "in the middle" search, put stars at both ends.

Here is a URL that may help:
http://office.microsoft.com/en-us/access-help/examples-of-query-criteria-HA010066611.aspx
0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 39660459
If you want to find all Name values that contain both values, then you would need to do:
Name LIKE "*XYZ*" AND Name LIKE "*ABC*"
0
 

Author Closing Comment

by:GPSPOW
ID: 39660468
Thanks

Glen
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question