A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calculating age



 
 
Thread Tools Display Modes
  #1  
Old June 25th, 2008, 12:04 PM posted to microsoft.public.access.tablesdbdesign
Landor
external usenet poster
 
Posts: 18
Default Calculating age

Hi,
I need to calculate a persons age on a form. I have tried an unbound text
box with: Diff2Dates("ymd", [DOB], Date(), True) entered in the control
source but i only get an error message. Is there an easy way i can do this
with using VBA?
I have a DOB text box. I need to show a persons age in years and months and
if possible days too.
I am a bit of a novice so nothing too technical please :-)

many thanks
Landor
  #2  
Old June 25th, 2008, 02:15 PM posted to microsoft.public.access.tablesdbdesign
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Calculating age

If you are using the Diff2Dates function by Douglas Steele and Graham Seach:
http://www.accessmvp.com/DJSteele/Diff2Dates.html
there are a couple of points. The code needs to be in a Standard Module (as
opposed to the form's code module) in order for it to work as a text box
control source. Also, it needs to have an = sign in front of it when used
as the text box control source. Start with adding the = sign. If that
doesn't solve the problem you will have to investigate further, as follows.
To see if the code is in a standard (stand-alone) module, look for modules
listed in the database window (the window that appears when you open a
database; if it does not appear, try pressing the F11 key). Open the
modules and look for the code. You can press Ctrl + F to search within the
code if that helps.

"Landor" wrote in message
news
Hi,
I need to calculate a persons age on a form. I have tried an unbound text
box with: Diff2Dates("ymd", [DOB], Date(), True) entered in the control
source but i only get an error message. Is there an easy way i can do this
with using VBA?
I have a DOB text box. I need to show a persons age in years and months
and
if possible days too.
I am a bit of a novice so nothing too technical please :-)

many thanks
Landor


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.