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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|