![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Can someone help! I want to insert a feild on a Access 2000 database form where you insert Date of Birth in another feild I want in to automaticly caculate how old the person is in years can someone tell me how to do this. cheers Dave |
#3
| |||
| |||
|
|
1. Go to the module section 2. add module 3. add the following text to the module Public Function YearsOld(FrmN As String, CtlN As String) As Byte On Error GoTo err Dim DOB As Date DOB = Forms(FrmN).Controls(CtlN) If Not IsDate(DOB) Then GoTo xit YearsOld = DateDiff("y", DOB, DATE) xit: Exit Function err: Resume xit End Function On the DOB field, open the properties sheet and go to the afterupdate event Click on the ... and add the following **code** in the forms module window: Me.Controls("x").Value = YearsOld(Me.Name, "y") where x = the name of the control that shows the number of years and y = the control where people enter the their DOB. Any additional questions??? Please ask. "Dave PNNZ" <drakej37 (AT) hotmail (DOT) com> wrote in message news:40b9a8ab (AT) news (DOT) compass.net.nz... Can someone help! I want to insert a feild on a Access 2000 database form where you insert Date of Birth in another feild I want in to automaticly caculate how old the person is in years can someone tell me how to do this. cheers Dave --- Please immediately let us know (by phone or return email) if (a) this contains a virus (b) you are not the intended recipient (c) you consider this email to be spam. We have done our utmost to make sure that none of the above are applicable. THANK YOU Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004 |
![]() |
| Thread Tools | |
| Display Modes | |
| |