Function Calculate Age()

Function GetAge()

Put this function in the Module.

If today date is 4/1/14 and DOB field is 2/4/2000 then

=GetAge(DOB) = 14

You can use this function in form, query or report

Function GetAge(Bdate) As Integer
' Handle negative date ranges i.e. Bdate > TodayDate
'
If Bdate > Date then
            Msgbox “Birth date is a future date”
            GetAge =0
ElseIf IsNull(Bdate) Then
           ' do nothing, display 0 if the DOB field is blank
Else
          If Month(Date) <= Month(Bdate) And Day(Date) < Day(Bdate) Then
                       GetAge = Year(Date) - Year(Bdate) - 1
          Else
                       GetAge = Year(Date) - Year(Bdate)
          End If
End if
End Function

Example of using function in query

queryAge

 

 

 

 

Using function on form

AgeinForm

 

 

Using function in report

AgeinReport

 

 

 

 

Do not take extra medicine to make up a missed dose. http://deeprootsmag.org/2017/07/19/so-keith-richards-says-to-me/ viagra samples At such an age, a person tends to imagine lots of things and wants to try out different things deeprootsmag.org generic cialis online related to sex. The truth is it is only a viagra sildenafil treatment for erectile dysfunction treatment. Allograft tissue will online pharmacy levitra be taken and implanted under the skin and scalp of those who use the product.

Related posts