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

Union Query does not run!!!

Status
Not open for further replies.

kav123

Programmer
Jan 12, 2005
210
GB
I need to make this query run in Access
SELECT tblDocumentParticipant.*, NULL
FROM tblDocumentParticipant, tblEsoOption, tblSsvOption
WHERE (([tblDocumentParticipant.EsoOptionId]=0) AND ([tblDocumentParticipant.SsvOptionId]=0))
UNION
SELECT tblDocumentParticipant.*, tblEsoOption.EsoOptionShortDescription
FROM tblDocumentParticipant INNER JOIN tblEsoOption ON tblDocumentParticipant.EsoOptionId = tblEsoOption.EsoOptionId
WHERE (([tblDocumentParticipant.EsoOptionId]<>0))
UNION SELECT tblDocumentParticipant.*, tblSsvOption.OptionShortDescription
FROM tblDocumentParticipant INNER JOIN tblSsvOption ON tblDocumentParticipant.SsvOptionId = tblSsvOption.SsvOptionId
WHERE (([tblDocumentParticipant.SsvOptionId]<>0))
ORDER BY tblEsoOption.EsoOptionShortDescription, tblDocumentSsvOption.OptionShortDescription, tblDocumentParticipant.DocumentCategory, tblDocumentParticipant.DocumentDescription ;

I have the above Access query. I need to display this OptionShortDescription or SsvShortDescription based on which Id(Eso or Ssv) is non zero. I am getting stuck at the ORDER BY bit. How do i include the description fields in the first query. If i don't have the fields in the first query the order does not work. Any clarfications, let me know. Please this is urgent!!!
If there is any other way of approaching this problem, even better!!!
 
include an empty field...

select "" AS fldName from tblBlah...

--------------------
Procrastinate Now!
 
Yes, i have sorted this problem. I am passing a NULL value as the second parameter and it works, since there are now two columns in all the three select queries.
 
But thanks anyway for your time and effort.
 
I am setting the rowsource of a combo box, which is part of a subform, in its parent form. Now, in the after update event of the combo, i want to set the rowsource of the combo to a recordset, in the subform itself, since i need to perform some operations on the recordset. I have tried the Me.Parent.Recordsetclone, but doesnt seem to work.

Any ideas how this can be done??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top