set three criteria on one field

swaink

Active Member
Joined
Feb 15, 2002
Messages
432
Hi everyone I'm not so hot with this one and have been struggling for several hours to get query right.

I'm using Access 97 and have a small DB from which the user wishes to retreive data based on one particular field.

I have created a form based on the query and that works fine however the query is a problem.

The field being searched on is a general comments field and they wish to search for three critera for example *Transport or *National or * Coastal

The idea being that any data where all three are present will be displayed.

I've tried using like [] or like [] or like[] but this doesn't appear to work.

Does anyone have any suggestions as to where I'm going wrong please.

Best regards

Kevin (y)
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
One question first: Do you want "any data where all three are present will be displayed," like you said in your original post, or do you want data where any of the three will be present? I'm confused, because unless you have a rather large field, I'd guess that only one of the three will be in one field...

Thank you,

Russell
 
Upvote 0
Hi Russell

Thanks for your response, the field being searched is up to 255 charaters in length and the users enter comments on current projects.

The user may wish to search and retrieve files that contain transport but this will bring back every file with transport in it, therefore they would prefer to search for "Transport" and "Coastal" for example to get only those files that contain both words the third criteria may be "study".

So again as an example they may wish to view files where the project is regarding transport, in coastal areas, where a study has been under taken.

I hope that hasn't confussed you even more

Kevin (y)
 
Upvote 0
Ok, then try something like:

[fldProj] Like "*Transport*" And [fldProj] Like "*Coast*" And [fldProj] Like "*study*"

HTH,

Russell
 
Upvote 0
Hi Russell :biggrin:

Thanks for your help that did the trick

I appreciate your time

Best regards

Kevin (y)
 
Upvote 0

Forum statistics

Threads
1,221,550
Messages
6,160,459
Members
451,648
Latest member
SuziMacca

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top