This is getting a little confusing; let's break it down.
From what I'm reading, you want to only return those records that meet two sets of criteria:
1) Age in [2,6,13]
2) Anniversary Date in CurrentDate to (CurrentDate +28)
Based on these criteria you need to define "Age" and "Anniversary Date"
You've defined "Age" as
{@FullYears}
numbervar CMonth:=Month({DOB.DOB});
numbervar CDate:= Day({DOB.DOB});
numbervar CYear:= Year({DOB.DOB});
numbervar TmpMonth:=Month(CurrentDate);
numbervar TmpDate:= Day(CurrentDate);
numbervar TmpYear:=Year(CurrentDate);
numbervar FtrMonth:=Month(CurrentDate +28);
numbervar FtrDate:=Day(CurrentDate +28);
numbervar FtrYear:=Year(CurrentDate +28);
If
CMonth in TmpMonth to FtrMonth and
CDate in TmpDate to FtrDate
Then
TmpYear - CYear
Your formula doesn't work because the Day value recycles at the start of the month. If you
ran this report today (04/24/2001) then your formula looks like this in plain English:
If
CMonth in 4 to 5 and
CDate in 24 to 21
Then
2001 - CYear
Crystal Reports interprets CDate range as 21 to 24; not what you are looking for...
The MS Access Table I created has only two fields: Name and DOB. I've only entered values
for the twelve sample Dates of Birth you've given. Because you haven't specified whether
the the 'Age' value is the Member's Age as of today or as of their Anniversary Birthdate, I
wrote two sample formulas:
{@CurrentAge}
//in full years:
NumberVar CYear;
If
Month({DOB.DOB}) < Month(CurrentDate)
Then
CYear:= Year(CurrentDate)
Else
If
Month({DOB.DOB}) = Month(CurrentDate) and
Day({DOB.DOB}) <= Day(CurrentDate)
Then
CYear:= Year(CurrentDate)
Else
CYear:= Year(CurrentDate)-1;
CYear - Year({DOB.DOB})
{@AgeonAnniversary}
//in full years:
NumberVar NextAnnivYr;
NextAnnivYr-Year({DOB.DOB})
This second formula shares the NextAnnivYr variable defined in the [COLOR=
blue]{@NextAnniversaryDate}[/color] formla which I've revised as follows:
{@NextAnniversaryDate}
NumberVar NextAnnivYr;
DateVar NextAnnivDt;
//Defines the Next Anniversary Year:
If
Month({DOB.DOB}) < Month(CurrentDate)
Then
NextAnnivYr:= Year(CurrentDate) + 1
Else
If
Month({DOB.DOB}) = Month(CurrentDate) and
Day({DOB.DOB}) < Day(CurrentDate)
Then
NextAnnivYr:= Year(CurrentDate) + 1
Else
NextAnnivYr:= Year(CurrentDate);
//Defines the Next Anniversary Date:
NextAnnivDt:= Date(NextAnnivYr, Month({DOB.DOB}), Day({DOB.DOB}));
//The Next Anniversary Date:
NextAnnivDt;
For data validation purposes, I wrote a
{@DaystoAnniverary} formula:
{@DaystoAnniverary}
{@NextAnniversaryDate} - CurrentDate
The base records returned look like this (ordered by "Days to Birthday"

:
Name DOB Next Current Days to Age on Full
Birthday Age Birthday Birthday Years
Name8 04/24/199 04/24/2001 2 0 2 2
Name1 04/25/199 04/25/2001 1 1 2 0
Name12 04/29/199 04/29/2001 5 5 6 0
Name10 05/03/198 05/03/2001 12 9 13 0
Name2 05/12/199 05/12/2001 1 18 2 0
Name6 05/20/199 05/20/2001 5 26 6 0
Name9 05/25/198 05/25/2001 12 31 13 0
Name5 08/08/199 08/08/2001 4 106 5 0
Name3 12/12/200 12/12/2001 0 232 1 0
Name11 01/01/199 01/01/2002 5 252 6 0
Name4 01/13/199 01/13/2002 6 264 7 0
Name7 02/25/198 02/25/2002 12 307 13 0
My record selection criteria is:
{@CurrentAge} in [2,6,13] and
{@NextAnniveraryDate} in CurrentDate to (CurrentDate + 28)
Only one record is returned based on the twelve sample Dates-of-Birth you listed.
Name DOB Next Current Days to Age on Full
Birthday Age Birthday Birthday Years
Name8 04/24/199 04/24/2001 2 0 2 2
If change the record selection criteria to:
{@AgeonAnniversary} in [2,6,13] and
{@NextAnniveraryDate} in CurrentDate to (CurrentDate + 28)
then four records are returned:
Name DOB Next Current Days to Age on Full
Birthday Age Birthday Birthday Years
Name8 04/24/199 04/24/2001 2 0 2 2
Name1 04/25/199 04/25/2001 1 1 2 0
Name12 04/29/199 04/29/2001 5 5 6 0
Name10 05/03/198 05/03/2001 12 9 13 0
Name2 05/12/199 05/12/2001 1 18 2 0
Name6 05/20/199 05/20/2001 5 26 6 0
Please note, I only received six values where you listed seven expected returns above. This is because one of your Anniversary Dates is 31 days out...