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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple field searches??

Status
Not open for further replies.

kp1279

Programmer
Jan 21, 2005
43
GB
I have a database created. I am trying to create a query where I can search a number of fields with the same search text.

I can do this for individual fields with no problems, but I want to create a criteria like

' Like "*" &[Enter search text]& "*" '

But I want this to search a number of fields at the same time.

How do I do this?
Do I have to link the fileds? if so how?

ps: put your responce in plain talk, as I am only self taught, thanks you.
 
In the WHERE clause of the generated SQL code:
WHERE ...
AND ([Field1] Like '*' & [Enter search text] & '*'
OR [Field2] Like '*' & [Enter search text] & '*'
OR [Field3] Like '*' & [Enter search text] & '*'
) AND ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have 5 fields 'dissem' - 'dissem2' - 'dissem3' - 'dissem4' & 'dissem5'

If i want to search for something like 'London' (Which I want to be prompted for as the search changes) in this query, from any of those fields, and produce the datasheet after only entering the criteria once where would it go.

I have found the SQL and at the moment it reads:

WHERE (((
.dissem)=[enter search text]))

where do I put the other 4 fields in this??

KP
 
WHERE (
.dissem Like '*' & [enter search text] & '*'
Or
.dissem2 Like '*' & [enter search text] & '*'
Or
.dissem3 Like '*' & [enter search text] & '*'
Or
.dissem4 Like '*' & [enter search text] & '*'
Or
.dissem5 Like '*' & [enter search text] & '*')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Can't let this slip by without a comment regarding possibly un-normalized tables. Any time I see field names like xxx1, xxx2, xxx3, xxx4,... it raises a red flag.

I could be wrong since it isn't my data.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top