Example of one query (QueryB) based on the results of another query
(QueryA):
QueryA = "SELECT CustID FROM tblCUSTOMERS WHERE CustName = 'A%'"
QueryB = "SELECT CustID, CustName FROM tblCUSTOMERS WHERE CustID IN (" &
QueryA & ")"
But the following is even faster and allows for more than one field to
be returned in QueryA:
QueryB = "SELECT tblCUSTOMERS.CustID, CustName FROM (" & strSQLA & ") AS
tblSQLA INNER JOIN tblCUSTOMERS ON tblSQLA.CustID = tblCUSTOMERS.CustID"
So QueryA would include all the CustID's for customers starting with A.
And QueryB would include more fields in the customers table (i.e. not
just the CustID field) for the records returned in QueryA (which was the
customers starting with A).
I suppose it wouldn't hurt to always use LEFT JOIN's in QueryB and build
from the tblSQLA on the left to other tables that have fields you want
to return.
Best regards,
J. Paul Schmidt, *** ASP Web Developer
http://www.yqcomputer.com/
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
*** Sent via Developersdex
http://www.yqcomputer.com/ ***
Don't just participate in USENET...get rewarded for it!