Hi,
First the function
IIf(Nz(#23/03/2000#,"")="","","") a test like this gives me an error:
wrong number of arguments for the function nz()
Nz() is used like : nz(#23/03/2000#) or nz("23/03/2000") only with one argument...
But this part of the function isn't important coz it verifies if there is a birthdate introduced... So keep a part...
The rest of the function is:
DateDiff("yyyy","23/03/2000",Now())+(DateSerial(Year(Now()),Month("23/03/2000"),Day("23/03/2000")))
With string values it doesn't give me correct results...
with date values:
the same result...
But the function DateDiff("yyyy","23/03/2000",Now()) gives just the age without monts and days...
But after some verification you can use this one:
=str(Datediff("yyyy",Cvdate(Format("23/03/2000","DD/mm/yyyy")),Now()))+"/"str(Datediff("m",Dateserial(Year(Now()),Month(Cvd ate(Format("23/03/2000","DD/mm/yyyy"))),Day(Cvdate(Format("23/03/2000","DD/mm/yyyy")))),Now()))+"/" +str(Datediff("d",Dateserial(Year(Now()),Month(Now ()),Day(Cvdate(Format("23/03/2000","DD/mm/yyyy")))),Now()))
Have a nice evening!
The following works for me (in Access 2002) -- my Date-Of-Birth field is called "dob". This formula prevents "error" strings from appearing in the calculated age field when the dob field hasn't yet been entered or is invalid.
-
=IIf(Nz([dob],"")="","",DateDiff("yyyy",[dob],Now())+(Now()<DateSerial(Year(Now()),Month([dob]),Day([dob]))))
-
Hope this helps,
radio1