Calculate the age

R

Reg Vaz

Hi,
I am trying to calculate the age of a product in
Years/Month format, and was wondering how i could go about
doing this....

Thnx
Reg
 
G

Graham R Seach

Reg,

SELECT Abs(DateDiff("yyyy", Date1, Date2) - IIf(Format(Date1, 'mmdd') <=
Format(Date2, 'mmdd'), 0, 1)) & ' years ' & DateDiff('m', DateAdd('yyyy',
Abs(DateDiff('yyyy', Date1, Date2) - IIf(Format(Date1, 'mmdd') <=
Format(Date2, 'mmdd'), 0, 1)), Date1), Date2) & ' months' As ProductAge FROM
tblMyTable

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top