keyword

A

andrew

Can anyone help with this? - Is there any way I can do this (just
searching a table) for a keyword using a query which I can then base a
report on so if I run the report I get details of any record in the table
which includes the keyword?

Andrew
 
J

John Spencer

Do you mean you want to search every field in the table and see if it contains
a specific value somewhere in the field?

Yes, it can be done.

One method would be to use a parameter query where you have the same parameter
criteria against each field

SELECT *
FROM [Some Table]
WHERE FieldA Like "*" & [Find what?] & "*"
OR FieldB Like "*" & [Find what?] & "*"
OR FieldC Like "*" & [Find what?] & "*"

If you are using design view you would have to set criteria under each field to
Like "*" & [Find what?] & "*"
And each criteria entry would have to be on a separate line.

Another method would be to concatenate the fields together in one long
"phrase" and then search that.

Field: FieldA & " " & FieldB & " " & FieldC
Criteria: Like "*" & [Find what?] & "*"

Whether or not you should be searching like this is another question. In all
probability the need to do this implies a bad design.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
W

Wayne-I-M

Hi Andrew

Say you have a field containing 1st names
John, Jill, Jack, Jack, Jack, Jill, Sally, John, etc (note more than one of
some names)

Base your report on a query and in the criteria row of the field containing
the names put this

Like [Insert Name]

This will filter the query before the report is printed. So if you put in
John you report would show 2 records, etc.

Good luck
 

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