Business starts on first October of every year. I need two queries, one which returns all records for current business year and the other returns all records for previous business year. Leap year is not important in this case.
I have written:
strSql1 = "SELECT * FROM Orders WHERE DateDiff('d',
[OrderDate], [YearStart])<=365 ORDER BY [OrderDate] ASC"
Me.frmCurrentYear.Form.RecordSource = strSql1
strSql2 = "SELECT * FROM Orders WHERE DateDiff('d', [OrderDate],
[YearStart])>365 AND DateDiff('d', [PurchaseDate],[YearStart]<=730) ORDER BY
[OrderDate] ASC"
Me.frmPreviousYear.Form.RecordSource = strSql2
Questions:
From my code, I will have to add a
YearStart
field to my table. Is there a way to avoid this?Would using
BETWEEN
be a more efficient way?
With thanks.