Is there away to insert this SQL code:
SELECT Count([AFB.RiskReference]) AS NoOfRisks FROM (SELECT DISTINCT [AFB.RiskReference] from AFB);
into this:
SELECT Synds.SyndicateName, Users.UserName, AFB.COB, Sum(AFB.Time) AS TotalTime, AFB.DocType, AFB.Task, Sum(AFBBenchmarks.Benchmark) AS TotalBMTime, [TotalTime]-[TotalBMTime] AS [+/-BMT], ([TotalTime]/[TotalBMTime]) AS [TimeTakenAs%OfBMT]
FROM ((AFB INNER JOIN Users ON AFB.User = Users.UserInitials) INNER JOIN AFBBenchmarks ON (AFB.DocType = AFBBenchmarks.DocType) AND (AFB.COB = AFBBenchmarks.COB) AND (AFB.Task = AFBBenchmarks.Task)) INNER JOIN Synds ON AFB.Syndicate = Synds.Psuedonym
WHERE (((AFB.Date)>=[forms]![Reports]![txtFromDate] And (AFB.Date)<=[forms]![Reports]![txtToDate]))
GROUP BY Synds.SyndicateName, Users.UserName, AFB.COB, AFB.DocType, AFB.Task
HAVING (((Users.UserName)=IIf([forms]![Reports]![cboUsers]="ALL",[UserName],[forms]![Reports]![cboUsers])));
Thanks.