Select * From TableName Where Field1 = [Enter Parameter] And Field2 = [Enter
Parameter] And Field3 = [Enter Parameter]
It will prompt the user only once for the [Enter Parameter]
--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck
"Chuck216" wrote:
> Is it possible and if so how? I have 3 fields in the same query that I want
> to search with the same value input from the user. I want the user to only
> have to input the search criteria once and have it search the 3 fields.
>
> Thanks for the help in advance.
>
Yes, this is possible, but it indicates that you may not have a properly
normalized database structure. You should not be storing similar information
into three fields.
As a short term solution, you can use a union query to produce a single
column recordset, which you then use as the basis for your search. A union
query can only be created using the SQL View. Create a new query and select
the appropriate table. In query design, click on View > SQL View. Enter a SQL
statement similar to the following, making the appropriate substitutions for
the names of the fields and the table name:
SELECT [Field1] AS Entity
WHERE [Field1] IS NOT NULL
FROM [TableName]
UNION
SELECT [Field2] AS Entity
WHERE [Field2] IS NOT NULL
FROM [TableName]
UNION
SELECT [Field3] AS Entity
WHERE [Field3] IS NOT NULL
FROM [TableName]
ORDER BY Entity
Save this query. You can use this query as the source for another query, or
you can add a parameter prompt directly to this query. Note that the result
is a read only recordset. The square brackets are required if your field
and/or table names include spaces or reserved words in Access/JET.
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
SELECT [Field1] AS Entity
FROM [TableName]
WHERE [Field1] IS NOT NULL
UNION
SELECT [Field2] AS Entity
FROM [TableName]
WHERE [Field2] IS NOT NULL
UNION
SELECT [Field3] AS Entity
FROM [TableName]
WHERE [Field3] IS NOT NULL
ORDER BY Entity
Tom
http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
>Is it possible and if so how? I have 3 fields in the same query that I want
>to search with the same value input from the user. I want the user to only
>have to input the search criteria once and have it search the 3 fields.
>
>Thanks for the help in advance.
In the query grid put the search criterion under each of the three
fields, on SEPARATE LINES of the query grid. I presume you're using
[Enter search term:]
as the parameter for the criterion. The SQL view would have
... WHERE [Field1] = [Enter search term:] OR [Field2] = [Enter search
term:] OR [Field3] = [Enter search term:]
The need to do this does set off some alarm bells in my mind: if these
fields are named, say, Keyword1, Keyword2, Keyword3 or are otherwise
repeating fields, you may need to consider instead having two tables
in a one-to-many relationship. "Fields are expensive, records are
cheap"!
John W. Vinson[MVP]
So, I wouldn't jump and say that the DB is "badly designed, unnormalized
database", you can suggest the answer for the question, and include your
point of view, just as John Vinson did.