A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Compound Select



 
 
Thread Tools Display Modes
  #1  
Old July 17th, 2008, 02:24 PM posted to microsoft.public.access.queries
JimS
external usenet poster
 
Posts: 252
Default Compound Select

I have a cool new form I'm having trouble with the rowsource
property...primarily because I'm hard-headed... Here's the situation:

I want to select as my row source all SERIALs that are NOT in the
many-to-many relationship with a certain Equipment-class (in a combo box
called cbToolClassID). I think it's a compound query. I've implemented it
using stored queries, and it works. But I want it to be in one SQL statement
in the rowsource property since the stored queries are otherwise stored
outside the form for no other reason.

Row Source:
SELECT DISTINCT tblMICAP.MICAP, tblMICAP.ToolDescription, tblMICAP.ID FROM
tblMICAP LEFT JOIN qryxrefToolClassID ON tblMICAP.ID =
qryxrefToolClassID.MICAPID WHERE (((qryxrefToolClassID.MICAPID) Is Null));

qryxrefToolClassID:
SELECT tblxrefMICAPToolClass.ID, tblxrefMICAPToolClass.MICAPID,
tblxrefMICAPToolClass.ToolClassID
FROM tblxrefMICAPToolClass
WHERE (((tblxrefMICAPToolClass.ToolClassID)=[cbToolClassID]));


Can't I make this into one statement?
--
Jim
  #2  
Old July 17th, 2008, 04:44 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Compound Select

You should be able to do it with a union query, BUT, the fields in both
queries must match. Same number of fields, in same order, and same datatype.

Like this --
SELECT DateTime, Text, Number-long integer, memo, Number-single
FROM xxx
UNION ALL SELECT DateTime, Text, Number-long integer, memo, Number-single
FROM yyyy
WHERE DateTime Date();

--
KARL DEWEY
Build a little - Test a little


"JimS" wrote:

I have a cool new form I'm having trouble with the rowsource
property...primarily because I'm hard-headed... Here's the situation:

I want to select as my row source all SERIALs that are NOT in the
many-to-many relationship with a certain Equipment-class (in a combo box
called cbToolClassID). I think it's a compound query. I've implemented it
using stored queries, and it works. But I want it to be in one SQL statement
in the rowsource property since the stored queries are otherwise stored
outside the form for no other reason.

Row Source:
SELECT DISTINCT tblMICAP.MICAP, tblMICAP.ToolDescription, tblMICAP.ID FROM
tblMICAP LEFT JOIN qryxrefToolClassID ON tblMICAP.ID =
qryxrefToolClassID.MICAPID WHERE (((qryxrefToolClassID.MICAPID) Is Null));

qryxrefToolClassID:
SELECT tblxrefMICAPToolClass.ID, tblxrefMICAPToolClass.MICAPID,
tblxrefMICAPToolClass.ToolClassID
FROM tblxrefMICAPToolClass
WHERE (((tblxrefMICAPToolClass.ToolClassID)=[cbToolClassID]));


Can't I make this into one statement?
--
Jim

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.