Background
Between [BeginDate] And [EndDate]
Year([InvoiceDate])=Year(Date())
Problem When User enter [BeginDate]=10/1/2017 And [EndDate]=10/31/2017, My This year's $ sum includes current month (November)'s data as well.
Goal I want to parse months, from January upto Between [BeginDate] And [EndDate]
's month of current year
Any help would be highly appreciated!
Update: I have tried
Year([InvoiceDate])=Year(Between [BeginDate] And [EndDate])<=Month(Between [BeginDate] And [EndDate])
But I'm getting ODBC failed error. is it because it's a long criteria?
Start and end dates in different years are possibly a problem, but this criteria string will always give you YTD for the year of the EndDate:
[InvoiceDate] <= [EndDate] AND [InvoiceDate] >= "1/1/" & Year([EndDate])
You could use BETWEEN if you like too:
[InvoiceDate] BETWEEN "1/1/" & Year([EndDate]) AND [EndDate]