I'm trying to select records based on a date range which is automatically computed based on entry of only the month and year. The format is YYYYMMDD. I want to add a few days before the beginning of the month and a few after so I chose the 25th and the 5th as the days.
If the month =1 and the year = 2002 the range should be
>= "20011225" and <= "20020205"
If the month =12 and the year = 2002 the range should be
>= "20021125" and <= "20030105"
This is what I've written, but it doesn't return any records. If I enter just the date range it works.
I'm hoping it's just a syntax issue.
>=IIf([Month]="1",([Year]-1) & "1225",IIf([Month]<"11",[Year] & "0" & ([Month]-1) & "25",[Year] & ([Month]-1) & "25")) And <=IIf([Month]="12",([Year]+1) & "0105",IIf([Month]<"9",[Year] & "0" & ([Month]+1) & "05",[Year] & ([Month]+1) & "05"))
Any help would be appreciated.
If the month =1 and the year = 2002 the range should be
>= "20011225" and <= "20020205"
If the month =12 and the year = 2002 the range should be
>= "20021125" and <= "20030105"
This is what I've written, but it doesn't return any records. If I enter just the date range it works.
I'm hoping it's just a syntax issue.
>=IIf([Month]="1",([Year]-1) & "1225",IIf([Month]<"11",[Year] & "0" & ([Month]-1) & "25",[Year] & ([Month]-1) & "25")) And <=IIf([Month]="12",([Year]+1) & "0105",IIf([Month]<"9",[Year] & "0" & ([Month]+1) & "05",[Year] & ([Month]+1) & "05"))
Any help would be appreciated.