search more than one field for the same data

G

Guest

What seemed like a simple question has turnied in to a nightmare. I have to
make an ajustment to a search in a database for a friend. he is using the
database to store telephone numbers. these can include a persons work number,
home number and mobile. these are stored in individual fields so that the can
be identified.

My question is this. I need to search all three number fields to look for
one number what is the best way to do do this so that in the query you get
asked once for the number and then the query searches the THREE phone fields
to look for that contacts number.
 
R

Rick B

Under the fields put something like...

=[Enter Phone]

Put it under each column, but put each one a separate row to create an *OR*
statement.
 
C

Casey via AccessMonster.com

assuming that the table is called number and the fields are as follows: home
phone = hphone, work phone = wphone, and cell phone = cphone this is what you
would do.

SELECT *
FROM number
WHERE hphone = [PHONE NUMBER]
OR wphone = [PHONE NUMBER]
OR cphone = [PHONE NUMBER];

This will ask the user for the PHONE NUMBER once and will compare all the
fields to it
 
G

Guest

Rick B said:
Under the fields put something like...

=[Enter Phone]

Put it under each column, but put each one a separate row to create an *OR*
statement.

--
Rick B



Simon said:
What seemed like a simple question has turnied in to a nightmare. I have
to
make an ajustment to a search in a database for a friend. he is using the
database to store telephone numbers. these can include a persons work
number,
home number and mobile. these are stored in individual fields so that the
can
be identified.

My question is this. I need to search all three number fields to look for
one number what is the best way to do do this so that in the query you get
asked once for the number and then the query searches the THREE phone
fields
to look for that contacts number.


Fantastic... Truely thank you very much both of these posts have helped. I knew there had to be an easy answer. Thank you again!!!
 

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

Top