Discussion Locked

Query Expression in Access problem

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi all

Im tearing my hair out here!!! I am trying to work out an age from a date of birth and using the Now() function in Access.

The problem is that any date of birth over 1972 -i.e. 16/09/1973 - shows as 4 figures even though I have formatted the field to yy and zero decimal places. The formula I have used for the expression is, AGE: Now()-[dob]

Has anyone any ideas

Thanks
Brian

4 replies

by dklippert

See if Dev Ashish's instructions help. You may have to split up the answer into years, months etc.

http://tinyurl.com/grbe

by techrep

This code works fine for me:

Dim Age, BirthDate
BirthDate = #9/16/73#
Age = Now - BirthDate
Age = Format(Age, "yy")
Debug.Print "Age = " & Age 'Age=29

This discussion is closed to new replies.