Was wondering if I can modify this into the existing query to avoid a circular ref. rather than having to run a separate query and join or refer to it some other way on a report.
The purpose of this is to get a certain count of rows so that I don't have to hard code the number of rows into reports. The report uses this number to create an average in the footer. For example if there are 26 rows of data, the formula would result in 22 and the text box on the report would calculate ( txtCumGroup/22 ). If not in the query, what code/formula could be used on the report itself to figure out how many rows to divide by?
Here is the query (red is where I tried to add the subquery.)
Code:
SELECT count(*)
FROM qryAttritionTransfer
WHERE FirstTerm<=(Select Max([FirstTerm]-2) From qryAttritionTransfer)
The purpose of this is to get a certain count of rows so that I don't have to hard code the number of rows into reports. The report uses this number to create an average in the footer. For example if there are 26 rows of data, the formula would result in 22 and the text box on the report would calculate ( txtCumGroup/22 ). If not in the query, what code/formula could be used on the report itself to figure out how many rows to divide by?
Here is the query (red is where I tried to add the subquery.)
Code:
SELECT "ALL" AS MainGroup, IIf(Right([incomingCohort],1)="S",Left([IncomingCohort],4)-1 & Right([incomingCohort],1),[IncomingCohort]) AS IncomingCohortSort, qryTransfer.IncomingCOHORT AS FallTerm, IIf(Right([incomingCohort],1)="S",Left([IncomingCohort],4)-1,Left([IncomingCohort],4)) AS FirstTerm, Sum(qryTransfer.RecordCount) AS BeginCohort, Sum([recordCount]-[FirstAttend]) AS Yr1Sem_Num, [Yr1Sem_Num]/[BeginCohort] AS Yr1Attrition, Sum([FirstAttend]-[SecondAttend]) AS Yr2Sem_Num, IIf(IsNull([Yr2Sem_Num]),0,1) AS Yr2Years, [Yr2Sem_Num]/[BeginCohort] AS Yr2Attrition, Sum([FirstYrDisqual]+[SecondYrDisqual]) AS Yr2CumDisq, Sum(qryTransfer.GradWIN2) AS GradWIN2, [red](SELECT count(*)
FROM qryAttritionTransfer
WHERE FirstTerm<=(Select Max([FirstTerm]-2) From qryAttritionTransfer)) AS Expr1[/red]
FROM qryTransfer
GROUP BY "ALL", IIf(Right([incomingCohort],1)="S",Left([IncomingCohort],4)-1 & Right([incomingCohort],1),[IncomingCohort]), qryTransfer.IncomingCOHORT, IIf(Right([incomingCohort],1)="S",Left([IncomingCohort],4)-1,Left([IncomingCohort],4))
HAVING (((IIf(Right([incomingCohort],1)="S",Left([IncomingCohort],4)-1,Left([IncomingCohort],4))) Between 1993 And 2005));