I need to query a table about next x anniversary dates, based on birthdate.
Can someone teel me how to do it?
Thanks.
Can someone teel me how to do it?
Thanks.
SELECT UserName, UserBirthday FROM tblUsers
WHERE UserBirthday Between Date() And DateAdd("d",7,Date());
SELECT UserName, UserBirthday FROM tblUsers WHERE UserBirthday Between Date() And Forms!frmBirthdays!txtEndDate;
DateSerial = Format(DateToConvert, "y")
expAnniversary: CDate(Left(CStr([UserBirthday]),InstrRev(CStr([UserBirthday]),"/")) & Year(Now()))
expAnniversary:
IIf(CDate(Month([UserBirthday])<Month(Now()),
CDate(Left(CStr([UserBirthday]),InstrRev(CStr([UserBirthday]),"/")) & Year(DateAdd("yyyy",1,Now()))),
CDate(Left(CStr([UserBirthday]),InstrRev(CStr([UserBirthday]),"/")) & Year(Now())))
expAnniversary: IIf(CDate(Day([UserBirthday]) & "-" &
Month([UserBirthday]) & "-" &
Year(Now()))<Date();
CDate(Day([UserBirthday]) & "-" &
Month([UserBirthday]) & "-" &
Year(Now())+1);
CDate(Day([UserBirthday]) & "-" &
Month([UserBirthday]) & "-" &
Year(Now())))
SELECT DOB,
DateSerial(Year(Date()) + IIf(Month([DOB])*100+Day([DOB])<=Month(Date())*100+Day(Date()),1,0),
Month([DOB]),
Day([DOB])) AS Anniversary
FROM tblDOB;
DOB Anniversary 25/06/1957 25/06/2010 25/12/1967 25/12/2009 01/01/2009 01/01/2010 29/02/2008 01/03/2010 14/06/1986 14/06/2010 14/12/2007 14/12/2009 08/12/2007 08/12/2010
Comment