On Sep 29, 10:50 pm, "Ken Snell \(MVP\)"
What am I doing wrong. Has something to do with missing parentheis.
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
([ClassroomID]="Kool Kidz", DateSerial(Year(Date()) -
(CLng(Format(Date(),"mmdd"))>901), 9, 1))- Hide quoted text -
- Show quoted text -
It works great to a point. Kool Kidz only should default to 9/1/?
only if [Date] is >=9/1/07
The expression I provided for when [ClassroomID]="Kool Kidz" should give you
a date of 9/1/07 for a current date (returned by the Date() function, which
gives you today's date) that is between January 1, 2007 and September 1,
2007; and a date of 9/1/08 for a current date of September 2, 2007 through
September 1, 2008.
Perhaps you don't want to test against today's date, but against the value
of the [Date] field in your table? If yes, then replace
Date()
with
[Date]
in the expression in both places where it's found:
DateSerial(Year([Date]) - (CLng(Format([Date],"mmdd"))>901), 9, 1)
--
Ken Snell
<MS ACCESS MVP>
It says that "the expression you entered contains invalid syntax, or
you need to enclose your text data in quotes. Below is the formula I
pasted into ACCESS. Thank you again for you support.
=Switch([ClassroomID]="Bumble Bears",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Doodlebugs",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Dandeelions",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Kinder-Ready",DateAdd("yyyy",1,[Date]),
[ClassroomID]="Kool Kidz"),DateSerial(Year([Date]) -
(CLng(Format([Date],"mmdd"))>901), 9, 1)- Hide quoted text -
- Show quoted text -