By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,497 Members | 2,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,497 IT Pros & Developers. It's quick & easy.

How do i calculate a difference between 2 dates ???

P: 1
I have a field called Date_Of_Birth and a field called Age...

How do i set MS Access to automatically calculate the age for me ?
Oct 11 '07 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
Normally we don't store a calculated field in a table. We just calculate it in a query "on the fly", as it will change depending on the Date() used :-)

Check:
http://www.mvps.org/access/datetime/date0001.htm
for some code. (And many other fine samples)

The described Datediff() function can be used in a query too like:
Expand|Select|Wrap|Line Numbers
  1. select DateDiff("yyyy", [Bdate], Now()) + Int( Format(now(), "mmdd") < Format( [Bdate], "mmdd") ) As Age, Dob from tblPerson.
Nic;o)
Oct 11 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.