<html>
<body>
<br>
Hello Folks,<br>
I'm hoping someone may be able to assist with a sub-query issue I
have.<br><br>
I have currently two queries that give me the results I want, but I want
to combine them into one query that gives me just one single answer that
I can drop into a textbox on a form.<br><br>
Call the following QUERY A - the bold in the WHERE clause will be
supplied as parameters in a function call:<br>
<font face="Times New Roman, Times" size=4>SELECT
tblCourseHolidays.CampusID, tblCourseHolidays.StartDate AS HolStart,
tblCourseHolidays.EndDate AS HolEnd, tblCourseHolidays.Weeks<br>
FROM (tblCampus INNER JOIN tblCourse ON tblCampus.ID =
tblCourse.CampusID) INNER JOIN tblCourseHolidays ON tblCampus.ID =
tblCourseHolidays.CampusID<br>
WHERE (((tblCourseHolidays.CampusID)=<b> CampusID</b>) AND
((tblCourseHolidays.StartDate)>#<b>StartDate</b>#) AND
((tblCourseHolidays.EndDate)<#<b>EndDate</b>#));<br><br>
</font><font size=2>Query A results in the following table (It finds out
the number of holiday weeks between two dates for a given Campus)<br>
CampusID  HolStart   HolEnd    Weeks<br>
SLC             
1/6/03      
8/6/03          1<br>
SLC             
13/6/03    
20/6/03       2<br>
SLC             
12/4/03   
19/4/03        1<br><br>
Now Query B uses the table above from Query A to SUM the weeks and give
me the figure 4, which I want to return as the result of the Function
call.<br><br>
</font>Call the following QUERY B:<br>
<font size=2>FunctionName =
</font><font face="Times New Roman, Times" size=4>"SELECT Sum([QUERY
A].Weeks) AS SumOfWeeks<br>
FROM [QUERY A];"<br><br>
</font><font size=2>QUERY B results in the following:<br>
SumOfWeeks<br>
4 <br><br>
</font><font face="Times New Roman, Times" size=4>QUESTION:<br>
</font><font size=2>How can I combine QUERY A into QUERY B so that it is
one SQL statement that I can put into a function call??? Thank you in
advance for your advice.<br><br>
David<br>
Brisbane<br>
Australia</font></body>
</html>