Trying to test DOB against 1 July in year of birth in a query (1 Viewer)

dermois

New member
Local time
Today, 11:45
Joined
Jan 29, 2020
Messages
1
I need to work out what class a pupil is in. In this system they start in year 1 if they are four years old before 1 July. e.g. born 29 June 2016 will join year 1 in Sept 2020 were as born 4 July 2016 will wait until Sept 2021. I'm happy with the maths for my true & false.

The following works SO LONG AS THEY WEREN'T born in a leap year.

YearGroup: IIf(DatePart('y',[DOB])<DatePart('y',#01/06/2020#),"true","false")

I can't work out how to check against 1 June YEAR OF BIRTH. Bee trying stupid stuff like

YearGroup: IIf(DatePart('y',[DOB])<DatePart('y',#01/06/#DatePart('yyyy',[DOB]),"true","false")

Any ideas would be very welcome. I'm new here.
 

plog

Banishment Pending
Local time
Today, 05:45
Joined
May 11, 2011
Messages
11,638
You really don't care about the day, so I think you can simply work this by testing the month:

YearGroup: Year([dob])+IIf(Month([dob])<7,5,4)

If the month is june or earlier you add 5 to the year of birth , otherwise add 4 to it.
 

Users who are viewing this thread

Top Bottom