Years between two dates

G

Guest

Hi!

I have:
Textbox1
=[Forms]![F_Inq]![SubF_Gr00].[Form]![DtEntr]
in Control Source
Medium Date in Format

TextBox2
BornDate in Control Source
Medium Date in Format

TextBox3
=[TextBox2]-[TextBox1]
in ControlSource

Return:
6.086 when Age=22 years old

What is the formulae to calc the correct age, in years, please?
Thanks in advance.
an
 
G

Guest

First, If you want to store this age in the control that is bound to
textbox3, then I strongly discourage it, search for posts on Age in this
newsgroup for reasons.

If, on the other hand, you just want to display the # of year between two
dates, you can use something like the following in the control source of an
unbound textbox

=datediff("yyyy", StartDate, EndDate) + (format(startdate, "mmdd") >
Format(enddate, "mmdd"))

The datediff( ) function computes the number of year (in this case)
boundries that are crossed, so if StartDate is 12/31/06 and EndDate is
1/1/07, the datediff function will return a 1. So you also need to determine
whether the anniversary of the start date has occured yet, if not, you need
to subtract one, which is what the second part of the equation does.

HTH
Dale
 
G

Guest

#NAME?

molsonexpert said:
what happens if you use the datediff function?

--
steve.


an said:
Hi!

I have:
Textbox1
=[Forms]![F_Inq]![SubF_Gr00].[Form]![DtEntr]
in Control Source
Medium Date in Format

TextBox2
BornDate in Control Source
Medium Date in Format

TextBox3
=[TextBox2]-[TextBox1]
in ControlSource

Return:
6.086 when Age=22 years old

What is the formulae to calc the correct age, in years, please?
Thanks in advance.
an
 
G

Guest

Thank you.
an

Daniel said:
For the complete age look at

http://www.cardaconsultants.com/en/msaccess.php?lang=en&id=0000000011#age

For just the year use the datediff function inconjunction with the yyyy
settings to only return the year value.
--
Hope this helps,

Daniel P


an said:
Hi!

I have:
Textbox1
=[Forms]![F_Inq]![SubF_Gr00].[Form]![DtEntr]
in Control Source
Medium Date in Format

TextBox2
BornDate in Control Source
Medium Date in Format

TextBox3
=[TextBox2]-[TextBox1]
in ControlSource

Return:
6.086 when Age=22 years old

What is the formulae to calc the correct age, in years, please?
Thanks in advance.
an
 
G

Guest

DF,

Thank you for your help.
an

Dale Fye said:
First, If you want to store this age in the control that is bound to
textbox3, then I strongly discourage it, search for posts on Age in this
newsgroup for reasons.

If, on the other hand, you just want to display the # of year between two
dates, you can use something like the following in the control source of an
unbound textbox

=datediff("yyyy", StartDate, EndDate) + (format(startdate, "mmdd") >
Format(enddate, "mmdd"))

The datediff( ) function computes the number of year (in this case)
boundries that are crossed, so if StartDate is 12/31/06 and EndDate is
1/1/07, the datediff function will return a 1. So you also need to determine
whether the anniversary of the start date has occured yet, if not, you need
to subtract one, which is what the second part of the equation does.

HTH
Dale

--
Email address is not valid.
Please reply to newsgroup only.


an said:
Hi!

I have:
Textbox1
=[Forms]![F_Inq]![SubF_Gr00].[Form]![DtEntr]
in Control Source
Medium Date in Format

TextBox2
BornDate in Control Source
Medium Date in Format

TextBox3
=[TextBox2]-[TextBox1]
in ControlSource

Return:
6.086 when Age=22 years old

What is the formulae to calc the correct age, in years, please?
Thanks in advance.
an
 
G

Guest

Ooops!

Return: "The expression ... invalid Sintax"
an

Dale Fye said:
First, If you want to store this age in the control that is bound to
textbox3, then I strongly discourage it, search for posts on Age in this
newsgroup for reasons.

If, on the other hand, you just want to display the # of year between two
dates, you can use something like the following in the control source of an
unbound textbox

=datediff("yyyy", StartDate, EndDate) + (format(startdate, "mmdd") >
Format(enddate, "mmdd"))

The datediff( ) function computes the number of year (in this case)
boundries that are crossed, so if StartDate is 12/31/06 and EndDate is
1/1/07, the datediff function will return a 1. So you also need to determine
whether the anniversary of the start date has occured yet, if not, you need
to subtract one, which is what the second part of the equation does.

HTH
Dale

--
Email address is not valid.
Please reply to newsgroup only.


an said:
Hi!

I have:
Textbox1
=[Forms]![F_Inq]![SubF_Gr00].[Form]![DtEntr]
in Control Source
Medium Date in Format

TextBox2
BornDate in Control Source
Medium Date in Format

TextBox3
=[TextBox2]-[TextBox1]
in ControlSource

Return:
6.086 when Age=22 years old

What is the formulae to calc the correct age, in years, please?
Thanks in advance.
an
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top