Nightowl4933
Tryin' to do it right...
- Local time
- Today, 22:55
- Joined
- Apr 27, 2016
- Messages
- 151
I've got a calculated date in a Query that I'm unable to sort by the result of that calculation.
The SQL is:
...but when I try to Order by the result, it just won't do it.
I've attached an image of the result (without the Sort) but, to give a bit more context, [CalcDate] is either [Granted] + [Limit] (in years) OR [Expiry], but only one or the other.
Thanks.
The SQL is:
Code:
SELECT tblAllApplications.[Initial Planning Application Reference], tblAllApplications.PlanningAuthority, tblAllApplications.[Date of Application] AS [Date], tblAllApplications.Granted, tblAllApplications.Received, tblAllApplications.Limit, tblAllApplications.Expiry, Format(IIf([Expiry]>DateAdd("yyyy",IIf([Limit]>0,[Limit],0),[Granted]),[Expiry],DateAdd("yyyy",IIf([Limit]>0,[Limit],0),[Granted])),"dd mmm yyyy") AS CalcDate
FROM tblAllApplications
WHERE (((tblAllApplications.ExpiryOption)=2 Or (tblAllApplications.ExpiryOption)=3));
I've attached an image of the result (without the Sort) but, to give a bit more context, [CalcDate] is either [Granted] + [Limit] (in years) OR [Expiry], but only one or the other.
Thanks.