Question : Subquery issue

I have the following SQL with a subquery counting the number of employees on the team.
Although it runs, I get an error "Error in list of function arguments: 'SELECT' not recognized.
Unable to parse query text."  

I am using the query builder in VS2008 hitting an ACCESS DB.

Anyone have an idea as to why or how I can re-structure to correct?

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
SELECT     tblEmployee.employeeLastName + ', ' + tblEmployee.employeeFirstName AS empFullName, SUM(DATEDIFF('h', Format(tblProduction.startDate, 
                      'short date') + ' ' + tblStartTime.[time], Format(tblProduction.endDate, 'short date') + ' ' + tblEndTime.[time])) AS totalHours, tblProducts.sam, 
                      tblProduction.totalProduced, tblTeams.teamName, tblTeams.teams_ID,
                          (SELECT     COUNT(tblTeamMembers.employee_ID) AS teamCount
                            FROM          tblTeamMembers
                            WHERE      tblTeamMembers.teams_Id = tblTeams.teams_ID)
FROM         (tblEmployee RIGHT OUTER JOIN
                      (((((tblTeamMembers INNER JOIN
                      tblTeams ON tblTeamMembers.teams_Id = tblTeams.teams_ID) INNER JOIN
                      tblProduction ON tblTeams.teams_ID = tblProduction.teams_ID) INNER JOIN
                      tblProducts ON tblProduction.product_ID = tblProducts.product_ID) INNER JOIN
                      tblTime tblStartTime ON tblProduction.startTime = tblStartTime.time_ID) INNER JOIN
                      tblTime tblEndTime ON tblProduction.endTime = tblEndTime.time_ID) ON tblEmployee.employee_ID = tblTeamMembers.employee_ID)
GROUP BY tblEmployee.employeeLastName + ', ' + tblEmployee.employeeFirstName, tblProducts.sam, tblProduction.totalProduced, tblTeams.teamName, 
                      tblTeams.teams_ID
ORDER BY tblEmployee.employeeLastName + ', ' + tblEmployee.employeeFirstName

Answer : Subquery issue

try call the function after you declared it
1:
2:
3:
4:
function display(){
echo 'hello';
}
display();
Random Solutions  
 
programming4us programming4us