formula in a form

D

Dahlman

I have a to different textboxes in my form with dates. I want another textbox
to give me years difference between the other two dates. Please help. Thanks
 
F

fredg

I have a to different textboxes in my form with dates. I want another textbox
to give me years difference between the other two dates. Please help. Thanks

As the control source of an unbound control on your form:
=DateDiff("yyyy",[Date1],[Date2])
 
R

Rick B

I would assume you want to calculate age?

I'd use something like...


DateDiff("yyyy",[Higherdatefield],[LowerDateField)+(Format([HigherDateField]
,"mmdd")>Format([LowerDateField],"mmdd"))




Hope that helps, Rick B




Dahlman said:
I have a to different textboxes in my form with dates. I want another textbox
to give me years difference between the other two dates. Please help.
Thanks
 
D

Dahlman

Thank you very much Fredg and Rick B. I had to use both of them because one
was age and another was years of service. I appreciate the help.
 
R

Rick B

The same "age" calculation would work for years of service. If you use the
other formula provided, it does not take into account if the date has passed
or not.

Rick B


Dahlman said:
Thank you very much Fredg and Rick B. I had to use both of them because one
was age and another was years of service. I appreciate the help.
Thanks
 
Top