I am attempting to create a query which determines what birthdays are coming up in the next 30 days... I've managed to create such a query that works but there is a major flaw.. It doesn't carry on to the next year.
Code:
SELECT SoliderData.Rank, SoliderData.LastName, SoliderData.FirstName, SoliderData.MiddleInitial, SoliderData.Sex, SoliderData.DOB, SoliderData.Section, SoliderData.Platoon, DateSerial(Year(Date()),Month([DOB]),Day([DOB])) AS Birthday
FROM SoliderData
WHERE ((Not (SoliderData.DOB) Is Null)
AND ((DateSerial(Year(Date()),Month([DOB]),Day([DOB]))) Between Date() And Date()+30));
I've have tried changing the WHERE clause to the following to attempt to include the the beginning of the year but get a "Data type Mismatch in criteria expression" error. Actually if I attempt to put any type of OR statement I get the same error... even if I copy the good line.
Code:
WHERE ((Not (SoliderData.DOB) Is Null)
AND DateSerial(Year(Date()),Month([DOB]),Day ([DOB])) Between Date() and Date() + 30
OR DateSerial(Year(Date()),Month([DOB]),Day ([DOB]))
Between DateAdd("yyyy",1,Date()) and DateAdd("yyyy",1,Date()) + 30
I'm Lost HELP!!