Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert age to date of birth

Status
Not open for further replies.

mjake13

Programmer
Aug 26, 2001
28
US
OK, I am trying to input an age into a text box and convert that age to the first of the year that the person was born.

ex- input 25, returns 1/1/77

This return would then be used as the criteria for a query to look up people born in that same year.

To take it one step farther, I would like the query to check 5 years above and below the returned year.

ex-input 25, returns 1/1/72-1/1/82

Any suggestions would be greatly appreciated.
 
1/1 in year of birth:
DateSerial(Year(Date()) - age, 1, 1)

1/1 in 5th year before birth:
DateSerial(Year(Date()) - age - 5, 1, 1)

1/1 in 5th year after birth:
DateSerial(Year(Date()) - age + 5, 1, 1) Rick Sprague
 
Thanks Rick, worked like I needed it too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top