Oops...I switched the order of the WHERE and FROM clauses. If you want to use
the union query, use this form instead:
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
__________________________________________
:
Hi Chuck,
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
__________________________________________
:
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.