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!

Parameter not working in Union Query 1

Status
Not open for further replies.

annie52

Technical User
Joined
Mar 13, 2009
Messages
164
Location
US
I want the query to display only one record when the user enters a Control #. However, it displays all records from one source (query) and none from the other query. When I don't include the Where clause, I can see all of my records from both queries.

Select [QDRNum] As [QDR/SDR], [Control], [Location], [JD], [Serial]
From [qryReqnsByQDR]
UNION Select [SDRNum] As [QDR/SDR], [Control], [Location], [JD], [Serial]
From [qryReqnsBySDR]
WHERE [Control]=[Enter the Control #]
ORDER BY [Control];

Thanks in advance for any ideas you may share.
 
What about this ?
Code:
Select [QDRNum] As [QDR/SDR], [Control], [Location], [JD], [Serial]
From [qryReqnsByQDR]
[!]WHERE [Control]=[Enter the Control #][/!]
UNION Select [SDRNum], [Control], [Location], [JD], [Serial]
From [qryReqnsBySDR]
WHERE [Control]=[Enter the Control #]
ORDER BY 2;

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Wow! You saved me twice today. Thanks a million.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top