A
ArielZusya
I've got a query that queries another query. I can't seem to figure out how
to properly embed the second query's SQL in the first as a subquery. I was
thinking it might be easier to refer to the two as sql statements in vba but
I'm now running into the same trouble. I was thinking I could use
CurrentDb.OpenRecordset(stMySQL1).Fields(0)
assigned to a string variable like stMyOutPut1 and then call that from the
second SQL statment but I'm struggling. Any help would be greatly
appreciated. In case it's useful here's the SQL from my two queries (note
that I'd like to embed that first in that second instead of calling to a
named query and dynamically fill in that refnum in vba but I can't figure out
how to do that):
qryShowAllInFirstRefNumGroup:
SELECT tblSeat.Seat, tblMain.ID_Main
FROM tblSeat RIGHT JOIN tblMain ON tblSeat.Seat = tblMain.Seat
WHERE (((tblMain.RefNum)="205CBV609"));
qryAllSeatsUnusedInFirstRefNumGroup:
SELECT Min(tblSeat.ID_Seat)
FROM qryShowAllInFirstRefNumGroup RIGHT JOIN tblSeat ON
qryShowAllInFirstRefNumGroup.Seat=tblSeat.ID_Seat
WHERE (((qryShowAllInFirstRefNumGroup.Seat) Is Null));
to properly embed the second query's SQL in the first as a subquery. I was
thinking it might be easier to refer to the two as sql statements in vba but
I'm now running into the same trouble. I was thinking I could use
CurrentDb.OpenRecordset(stMySQL1).Fields(0)
assigned to a string variable like stMyOutPut1 and then call that from the
second SQL statment but I'm struggling. Any help would be greatly
appreciated. In case it's useful here's the SQL from my two queries (note
that I'd like to embed that first in that second instead of calling to a
named query and dynamically fill in that refnum in vba but I can't figure out
how to do that):
qryShowAllInFirstRefNumGroup:
SELECT tblSeat.Seat, tblMain.ID_Main
FROM tblSeat RIGHT JOIN tblMain ON tblSeat.Seat = tblMain.Seat
WHERE (((tblMain.RefNum)="205CBV609"));
qryAllSeatsUnusedInFirstRefNumGroup:
SELECT Min(tblSeat.ID_Seat)
FROM qryShowAllInFirstRefNumGroup RIGHT JOIN tblSeat ON
qryShowAllInFirstRefNumGroup.Seat=tblSeat.ID_Seat
WHERE (((qryShowAllInFirstRefNumGroup.Seat) Is Null));