Tech2377
Programmer
- Nov 13, 2007
- 81
Using Crystal 10. I was referenced to use Ken Hamady's Age formula.
When I use this, I get an error on {SB1001_main.PatientBirthdate}. It keeps telling me "A date is required here". This is a DateTime field so I guess Im stumped.
When I use this, I get an error on {SB1001_main.PatientBirthdate}. It keeps telling me "A date is required here". This is a DateTime field so I guess Im stumped.
Code:
WhileReadingRecords;
DateVar Birth:= {SB1001_main.PatientBirthdate}; // Replace this with your field for Date Of Birth
DateVar Ann := {SB1001_main.ApptStart}; // Replace this with CurrentDate to get their age as of the time of the report
//or the date field of an event to get their age as of the time of that event.
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1