Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Single Criteria In Multiple Fields?

Status
Not open for further replies.

razman10

Technical User
Dec 17, 2002
31
US
Before asking my question, I would like to apologogize if this question has been answered before. I have searched in this and other forums and have not found anything. A few were close, but none really "Hit the spot". Anyway, here goes... Is there a way to pull records based upon single criteria in multiple fields. i.e. If field ParentID or If field SubID is equal to "ABCCO", retrieve data. I'm using Access 2002 and am creating the query in design view. Thank you for your help.

Razman10
 
Yes - put "ABCCO" on different lines in the Criteria lines for the SubID or ParentID fields.
This equates to the following SQL code:

WHERE (SubID = "ABCCO") Or (ParentID = "ABCCO")

John
 
Thank you... Exactly what I need. Now how can I use this logic with a user prompt? I would like to prompt the user "Enter ID Name" and have it look in both fields automatically without having the user input "ID Name" twice. I know how to use the prompt but how do I distribute the data to different columns in the criteria window?
 
Razman10

All you have to do is ensure that the prompts are the same -I tried it on a query here and it works fine in accesss 2002.
If entered once it will be used again if requested.

John
 
Here's one even easier and requires only one prompt...

field
test: instr([field1]& [field2] & [field3], [user prompt])

criteria
>0

 
Thank you all for your help... I'm all set. (For now at least!)

Razman10
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top