473,396 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to compute the age automatically on access if date of birth is already entered?

Is this possible? What are the codes that are in doing this function?
Jul 22 '14 #1
3 1134
BHo15
143 128KB
See if this helps...

http://allenbrowne.com/func-08.html
Jul 22 '14 #2
twinnyfo
3,653 Expert Mod 2GB
Have you tried something like this:

Expand|Select|Wrap|Line Numbers
  1. Public Function WhatIsAge(dtDOB As Date) As String
  2.     Dim intYears As Integer
  3.     Dim intMonths As Integer
  4.     Dim intDays As Integer
  5.     intYears = Format(Date - dtDOB, "yy")
  6.     intMonths = Month(Date - dtDOB) - 1
  7.     intDays = Day(Date - dtDOB)
  8.     WhatIsAge = "Age is " & _
  9.         intYears & " years, " & _
  10.         intMonths & " months, " & _
  11.         intDays & " days."
  12. End Function
Jul 22 '14 #3
NeoPa
32,556 Expert Mod 16PB
You can use DateDiff('yyyy',Date(),[DoB]) to calculate the approximate number of years then check the result for rounding by comparing Date() with DateAdd('yyyy',EarlierResult,[DoB]).
Jul 22 '14 #4

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

Similar topics

1
by: Jacquo Johnson | last post by:
I am receiving the following error: MS Access Date/Time DBD::ODBC::st execute failed: , , " . "FROM WHERE > '2004/02/01 11:16:16'"; $sth = $dbh->prepare($sqlstatement); $sth->execute ||...
2
by: hyde | last post by:
How can I get the current date to appear in a form - but also be able to change that date permanantly example i have a start date and and end date for my clients these two date calculate in...
3
by: yxq | last post by:
Hello, The XP Desktop clean wizard can get the last access time of desktop shortcut, i found that the info come from ...
11
by: carriolan | last post by:
Hi I have a very simple problem indeed, but I am unable to solve it. I am inputing a short date into an unbound text box with a short date input mask. I am in the UK so my date format is...
4
stormrider
by: stormrider | last post by:
Hi all, I'm trying to implement a Perl structure. My small program will do the followings; Take the birth date of the user as input. (Month's will be input as strings.) Take the current time...
1
by: Akinyemi | last post by:
I am devloping developing a payroll program. I want the program to compute Year to Date (YTD) values for Salary, Allowances, Dedections, Tax, Net Pay. I have tried very many times to write the...
1
by: chandurp | last post by:
Is there any attribute which indicate the last access date/time a user accessed DB2?
1
by: dharnE | last post by:
I'm Hoping that this Problem will answer.The Problem is"Create A Program to compute the pay of employees as entered by the user using function statement" Sample Output: Enter Number of Employees:3...
4
by: MunaAlBaloshi | last post by:
I am working with MS Access. But I want the date and time be automatically updated in the field. I know that I have to use VB codes. I try to write this code but it is not working. Private Sub...
4
beacon
by: beacon | last post by:
Hi everybody, I'm really hoping this will be the last problem I run into because I don't have much hair left to pull out! :) I have a form that the user will enter a census date (indexed field)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.