I'm trying to calculate age in Crystal Reports through visual studio (very weak with visual studio but I'm trying to learn it) and after lots of searching, haven't figured out why I'm getting an error and none of the questions on here helped.
My current result
I've done age successfully before, so I'm assuming it was the format. My sql results
I tried DateDiff ('yyyy', {Employee.BirthDate},CurrentDate ) but an error popped up that I needed a date. Tried Cdate (ToText({Employee.BirthDate}, 'MM/dd/yyyy')) but got this result
Any help or resources would be appreciated, thanks.
See if this one works,
datediff('yyyy',{Employee.BirthDate} ,currentdate)-(if datepart('y',currentdate)>datepart('y',{Employee.BirthDate}) then 0 else 1)