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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oops Correction on the Calculating Age on Form

Status
Not open for further replies.

Jeddiah

Programmer
Apr 30, 2002
17
US
I'm kind of new to Visual Basic. I know there is a way to calculate the age on a form using the date and year but I'm getting some weird results. Can someone out there assist me. Here is what I have so far:
I have an Age Field and a Birthday field, the birthday field is afterupdate reads =Age(), the Age field is unbound.


Private Function Age()
Dim Age As Integer
Dim Date As Date

[Age] = Date() - [Birthday]
End Function

This is a module attached to the Birthday Field

 
For a quick-and-dirty age calculation, set the control source of your age field to be something like this:
Code:
=(Int((Date()-[birthday])/365))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top