Calculating age

L

Landor

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
 
B

BruceM

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.
 

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