Link to home
Start Free TrialLog in
Avatar of tahirih
tahirih

asked on

Access Select Criteria with Wildcards

I would like to select two or more criteria, in Query Design View, using two or more criteria.

For example:

1. Medicare
2. Managed Medicare
3. Medicaid
5. Medicaid Out of State

I have attempted using a Wildcard, in the Criteria screen, where I use *Medicare and *Medicaid, in order to retrieve all these records.

Like "Medicaid" Or Like "Medicaid" - did not work either.

Please offer suggestions, with what to enter in the "Criteria" section of the Query Design View Table.

Thanks.
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Using MS Access:
YourColumn LIKE "*Medicare" Or YourColumn Like "*Medicaid"

Using ADO:
YourColumn LIKE "%Medicare" Or YourColumn Like "%Medicaid"
Example:

SELECT Table1.*, Table1.FIELD2
FROM Table1
WHERE (((Table1.FIELD1)="Medicare" Or (Table1.FIELD1)="Medicaid"));


mx
minor correction:

SELECT Table1.*
FROM Table1
WHERE (((Table1.FIELD1)="Medicare" Or (Table1.FIELD1)="Medicaid"));

mx
Avatar of tahirih
tahirih

ASKER

This did not work.

In the "Criteria" section, I place

Like "%Medicare" OR Like "%Medicaid"

Please also not that the Medicare or the Medicaid does not always have to be first in the string value. Therefore, please allow flexibility for the location of these two workds within the string

Thanks
Avatar of tahirih

ASKER

In this instance, please how I would add this into "Criteria" in Query Design View. Thanks.
can you post the SQL from the query design you have now ?

mx
>>This did not work.<<
Huh?  This is meaningless.  
1.  Did you get an error.  If so, what was the error.
2. Where the results not what you wanted, if not what were the results output and what were the desired results.
3. Did smoke come out of your monitor.

>>In the "Criteria" section, I place

Like "%Medicare" OR Like "%Medicaid"<<
Since you are obviously not using ADO why are you using %?
Avatar of tahirih

ASKER

Ok, I have gotten it to work partially myself. The following works in the "Criteria" box in Query Design:

Like "*Medicare*" Or Like "*Medicaid*"

So, I am retrieving all records that have these anywhere in the cell. However, I want o exclude anythign that says "Railroad Medicare" from this subset list.

Please advise.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tahirih

ASKER

Database, I have request the question to be re-opened, since I awarded points pre-maturely, before seeing your last postin. Thanks.
Avatar of tahirih

ASKER

AcPerkins, what I did on my own was to include the second * so that the placement of Medicare/Medicaid cound be anywhere in the string.

Thanks.
Avatar of tahirih

ASKER

Thanks.