VB code to calculate age

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Need help for write a VB code to calculate the age by year/month/days from birthday. If person is infant in days or month, and if person is over a year in year and month

ANY HELP IS GREATLY APPRECIATED.
 
Take a look at http://members.rogers.com/douglas.j.steele/Diff2Dates.html

Copy everything from between Code Start and Code End into a new module. Save
the module (making sure you don't name the module Diff2Dates, since that's
the name of the function)

Use the function as in the examples shown on the page.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


sid said:
Need help for write a VB code to calculate the age by year/month/days from
birthday. If person is infant in days or month, and if person is over a year
in year and month.
 
I am very new to access. I would like to use this code in my database
but I am not sure exactly where to place it, and what variables need t
be changed.

I'd like to use it to update a field on a form called 'child' that ha
a field called 'Birthdate' that I use to store (obviously) the child'
date of birth. I need to show years and months.

Can you please help me with explicit instructions on where to plac
your code, etc?

Thanks for your patience.
*Take a look a
http://members.rogers.com/douglas.j.steele/Diff2Dates.html

Copy everything from between Code Start and Code End into a ne
module. Save
the module (making sure you don't name the module Diff2Dates, sinc
that's
the name of the function)

Use the function as in the examples shown on the page.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


sid said:
Need help for write a VB code to calculate the age b
year/month/days from[/vbcol]
birthday. If person is infant in days or month, and if person is ove
a year
in year and month.[vbcol=seagreen]
ANY HELP IS GREATLY APPRECIATED.
[/vbcol]


-
mydnygh
 
Not sure how much more explicit I can be than I already was!

Open a new code module. Copy everything from between Code Start and Code End
into that new module. Save the module (making sure you don't name the module
Diff2Dates, since that's the name of the function). Nothing needs to be
changed in the code.

If you want to display the child's age in years and months on your form, and
your form is bound to a query based on your table, you can set the Control
Source of the text box that you can to display the age to

=Diff2Dates("ym", Me.Birthdate, Date())

(including the equal sign)



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


mydnyght said:
I am very new to access. I would like to use this code in my database,
but I am not sure exactly where to place it, and what variables need to
be changed.

I'd like to use it to update a field on a form called 'child' that has
a field called 'Birthdate' that I use to store (obviously) the child's
date of birth. I need to show years and months.

Can you please help me with explicit instructions on where to place
your code, etc?

Thanks for your patience.
*Take a look at
http://members.rogers.com/douglas.j.steele/Diff2Dates.html

Copy everything from between Code Start and Code End into a new
module. Save
the module (making sure you don't name the module Diff2Dates, since
that's
the name of the function)

Use the function as in the examples shown on the page.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


news:[email protected]...[vbcol=seagreen]
Need help for write a VB code to calculate the age by
year/month/days from[/vbcol]
birthday. If person is infant in days or month, and if person is over
a year
in year and month.[vbcol=seagreen]
ANY HELP IS GREATLY APPRECIATED.
[/vbcol] *
 
Back
Top