Hi Folks
I am sorry to post this as it must be a really simple issue but I just cannot get it!
I have an expression in a query which returns the current year as CY: Format([Date1],"yyyy",2,2)
I then have a Public Function as:
Public Function AvePerDayTY()
Dim ThisYear As Integer
ThisYear = Year(Date)
AvePerDayTY = Nz(DAvg("[TotalSales]", "QryYTDSales", "CY=ThisYear"))
End Function
This produces an error. If I change the criteria to actual year, eg. 2017, the function works.
What am I doing wrong here?
Many thanks
David