?
Solved

"Contains" function in MS-Access 2007

Posted on 2013-11-19
3
Medium Priority
?
4,111 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 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

765 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