CodeWidgets.com Online Source Code Library -ASP, ASP.NET, VB, VB.Net, Microsoft® Access, Javascript, VBScript, Website Design, Web Applications, Custom Programming Services Available.

 CodeWidgets.com ASP, ASP.NET, VB, VB.Net,
Microsoft® Access, Javascript, VBScript,
Website Design, Web Applications
Shopping Cart (0) Items $0.00      
 CodeWidgets.com
CodeWidgets.com

 

Website Stats to Date

Pages Viewed 6,940,643
Visitors 1,664,751
Widgets Viewed 4,483,408
Since January 1/2003
 
 
Active Users: 21
 

 
PayPal: Secure online payments!
 
Widget #CS0024

Age Function VB 6.0 Using DateDiff()

Age Function VB 6.0 Using DateDiff()

Send Link

Questions

Currency Conv.
  Widget Info  
Microsoft Access 2000/XP
Visual Basic 6.0
Enter birthdate, returns age in years.
Not applicable to infants under 1 year where age is measured in weeks or months


Public Function CurrentAge(Birthdate As Date) As Long
Select Case Month(Birthdate)
Case Is < Month(Date)
CurrentAge = DateDiff("YYYY", Birthdate, Now())
Case Is = Month(Date)
Select Case Day(Birthdate)
Case Is < Day(Date)
CurrentAge = DateDiff("YYYY", Birthdate, Now())
Case Is = Day(Date)
CurrentAge = DateDiff("YYYY", Birthdate, Now())
Case Is > Day(Date)
CurrentAge = DateDiff("YYYY", Birthdate, Now()) - 1
End Select
Case Is > Month(Date)
CurrentAge = DateDiff("YYYY", Birthdate, Now()) - 1
Case Else
CurrentAge = 0
End Select
End Function
 Licensing
Format: HTML Article
Online Document
Licencing Terms: Developer Re-Use: Programming Experience Required
Project Development Use Only. Re-Distribution Permitted only as part of a compiled Application. This source code is provided to you "as is" without warranty.
CLICK HERE FOR TERMS OF USE
Copyright 2002-2006 Comrie Software Solutions
 Related Widgets

Add new item to Combo Box when Not In List (Microsoft® Access)
Age Function VB.Net using DateDiff()
Alternate Subform/Datasheet row colors (Microsoft® Access)
Corrupted Access Database Repair
Date Validation Function (Microsoft® Access,VB.6.0)
Display a folders contents on a web page. (ASP)
Pop-Up Search Form Template
ProperCase Function VB 6.0

ShoppingCart Empty
Services Contact Info Legal Info
Designated trademarks and brand names are the property of their respective owners.

By accessing this website it is assumed that you agree to the TERMS OF USE.

Send questions or comments regarding this website to  Comrie Software Solutions.

Click here for a complete list of available Widgets.