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

#### dermois

##### New member
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
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.

Replies
17
Views
267
Replies
5
Views
774
Replies
4
Views
4,261
Replies
2
Views
3,646
S
Replies
6
Views
3,035
shurleexyz
S