Query search thru three fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have three differntly named fields that contain similar data. #1, #2, #3.
These 3 fields contain a 3 digit number. The same 3 digit number can be
found in any of the three fields (only once) for each record.

For the query I want to search all three fields and find a common number.
Ie, when asked for a #, and I enter 205, I want the query to search the 3
fields where this number can be found and provide a report of all these
records where 205 has appeared.
 
Open your select query in design view and in the criteria row of the first
field put this ---
[Enter search number]

Then hightlight, copy, drop down a row and paste in the second field. Drop
down another row and paste as criteria for the third field.
 
Just to amplify Karl's advise, it's imperative that you have the exact same
[Enter search number] as the criteria for each field. If there's a
difference, they won't be recognized as being the same, and you'll be
prompted more than once.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


KARL DEWEY said:
Open your select query in design view and in the criteria row of the first
field put this ---
[Enter search number]

Then hightlight, copy, drop down a row and paste in the second field.
Drop
down another row and paste as criteria for the third field.


Pin said:
I have three differntly named fields that contain similar data. #1, #2,
#3.
These 3 fields contain a 3 digit number. The same 3 digit number can be
found in any of the three fields (only once) for each record.

For the query I want to search all three fields and find a common number.
Ie, when asked for a #, and I enter 205, I want the query to search the 3
fields where this number can be found and provide a report of all these
records where 205 has appeared.
 
I have three differntly named fields that contain similar data. #1, #2, #3.
These 3 fields contain a 3 digit number. The same 3 digit number can be
found in any of the three fields (only once) for each record.

For the query I want to search all three fields and find a common number.
Ie, when asked for a #, and I enter 205, I want the query to search the 3
fields where this number can be found and provide a report of all these
records where 205 has appeared.

Douglas and Karl of course have the right answer... but in my capacity
as the the Normalization Cop, let me suggest that your table structure
needs a close look. Having the "same" data in three fields strongly
suggests that you're embeedding a one-to-many relationship in each
record. If you have three fields... someday you'll need four, and be
up the creek!

Any chance you could split this out to a properly normalized
one-to-many relationship to a new table?

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top