SELECT qryNextScheduled1.SITEID, qryNextScheduled1.MaxOfConstructionDate, IIf(Year(Date())-Year([MaxOfConstructionDate])<=2,5,IIf(Year(Date())-Year([MaxOfConstructionDate])<=5,6,7)) AS NextInspectionType, IIf([NextInspectionType]=5,DateSerial(Year([MaxOfConstructionDate])+2,6,1),IIf([NextInspectionType]=6,DateSerial(Year([MaxOfConstructionDate])+5,6,1),IIf(Right(Year(Date()),1)=Right(Year([MaxOfConstructionDate]),1),DateSerial(Year(Date()),6,1),IIf(10-Right(Year(Date()),1)<10-Right(Year([MaxOfConstructionDate]),1),DateSerial(Left(Year(Date()),3)+1 & Right(Year([MaxOfConstructionDate]),1),6,1),DateSerial(Left(Year(Date()),3) & Right(Year([MaxOfConstructionDate]),1),6,1))))) AS InspectionDate, Year([InspectionDate]) AS InspectionYear
FROM qryNextScheduled1;