Question Locked

Date Calculation

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have been trying to get a Calc Age (field name) to take DOB and get current age. I have tried all sorts of different codes/macros/scripts. Getting way to frustrated for something that should be farely simple. What happened to using Date() = [DOB]????? Does Access 2007 not like this function anymore???? Please help, thanks

3 replies

by john.a.wills

Public Sub CalculateAge()
Dim DateOfBirth As Date
Dim Current As Date
DateOfBirth = InputBox("date of birth", "DOB")
Current = Now()
MsgBox ("age now " & (Current - DateOfBirth) / 365.25)
End Sub

This discussion is closed to new replies.