Dalexan
asked on
Sub Select in MS Access 2002 not working
I am trying to create a sub select in access 2002 to work in a form. This is the code I am currently using, but access keeps telling me the sub select is invalid.
SELECT TblMediaExport.ord_confirm _date
FROM ([SELECT Table_and_Query_Lookup.Tbl MediaExpor t FROM Table_and_Query_Lookup WHERE Active = True] AS TblMediaExport)
WHERE ([TblMediaExport].[ord_id] )>0;
SELECT TblMediaExport.ord_confirm
FROM ([SELECT Table_and_Query_Lookup.Tbl
WHERE ([TblMediaExport].[ord_id]
That subselect has no field outputs unless tblMediaExport is a field name, which still leaves that it is not the field used in the main select...
There is bracketing in the subselect that I'm not sure belongs there also.
There is bracketing in the subselect that I'm not sure belongs there also.
Dalexan
You cannot reference anything from a sub if it's not defined (ord_id, ord_confirm_date).
Why do you want to run a sub on this ? It's simple enough, - you only have the table/query Table_and_Query_Lookup as input ? To me it looks like:
SELECT ord_confirm_date
FROM Table_and_Query_Lookup
WHERE ((ord_id>0) AND (Active = True));
Regards,
Sven
You cannot reference anything from a sub if it's not defined (ord_id, ord_confirm_date).
Why do you want to run a sub on this ? It's simple enough, - you only have the table/query Table_and_Query_Lookup as input ? To me it looks like:
SELECT ord_confirm_date
FROM Table_and_Query_Lookup
WHERE ((ord_id>0) AND (Active = True));
Regards,
Sven
and then there's that....
ASKER
This is the logic of what I am trying to do,
1.)this query will return a table name;
SELECT Table_and_Query_Lookup.Tbl MediaExpor t FROM Table_and_Query_Lookup WHERE Active = True
2.)this query has the above query as a subselect within, I need to use that value returned by the subselect in the main select to reference a field within the subselects returned table name.
This is difficult to explain, further explanation may be necessary!
Thanks for your help though.
1.)this query will return a table name;
SELECT Table_and_Query_Lookup.Tbl
2.)this query has the above query as a subselect within, I need to use that value returned by the subselect in the main select to reference a field within the subselects returned table name.
This is difficult to explain, further explanation may be necessary!
Thanks for your help though.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK,
This is farfetched, but if you're hooked on SQL then try this (no guarantees;-):
SELECT DLookUp("ord_confirm_date" ,SubXX.tbl XX,"[" & SubXX.TblXX & "].[ord_id])>0") AS ReturnValue
FROM (SELECT Table_and_Query_Lookup.Tbl MediaExpor t AS tblXX FROM Table_and_Query_Lookup WHERE Active = True) AS SubXX;
Sven
This is farfetched, but if you're hooked on SQL then try this (no guarantees;-):
SELECT DLookUp("ord_confirm_date"
FROM (SELECT Table_and_Query_Lookup.Tbl
Sven
FROM TblMediaExport
WHERE ([TblMediaExport].[ord_id]