Calculating an age with DateDiff
But it is calculating the difference between the 2 years, so making people 1 year too old if they were born after Day01Date.
Previously I had used
Age_a: (DateDiff("y", tblRacerDetails!DateofBirth,#01/06/2008#))/365
However this second method gives very strange values when I try using it based on a field rather than a single date
Thank you for taking the time to report an issue.
What's wrong... Please write below.
If IsNull(txt_DOB) Or IsNull(txt_Customer_ID) Then
txt_Age = DateDiff("yyyy", [DOB], Date) + (DateSerial(Year(Date), Month([DOB]), Day([DOB])) > Date)
It works fine on one computer, but for some unknown reason, when I run it on a different computer, I get this error (with Date highlighted)
Can't find object or library
On the form I would like to automate the age based on the DOB. I have this formula that was in an unbound field and worked, but I cant get it to work on the bound field:
Additionally, I dont always have the DOB, so I want to be able to type an age in too, (however the priority should be to calc the age if the dob exists).
Please could you
The code that I have is "Expr1: DateDiff("y",[Me].[BirthDate],DateAdd(6,"m",[Me].[CurrentDate]))". I have this to update the age "BeforeUpdate" in the form.
I have a field 'Age' in a Form that automatically derives the age from another field in the same Form, 'Date of Birth.' When I create/run a query where I want to show the age relevant to each record the date of birth field is shown but the 'age' field has no data showing? I suspect it may be something to do with the fact that the age field is an automatic calculation ratherthan a numerical entry.
I would though very much like to perform the simple task of showing the age per field.
The field 'Age' in the form is a calculated field with the following in the Control Source of the Property Sheet:
=DateDiff("y",[Date of Birth],Now())+Int(Format(Now(),"mmdd")
I put in this: DateDiff("d",([End Date],Date())-[Start Date])
I'm getting a wrong number of arguments error. I was also getting another error last night related to the "d" portion of the equation. Obviously I am pretty new and unsophisticated at this stuff so I thought I would check with the experts here for some
I have two text boxes, DOB (Date of Birth) and Age.
Age is not gotten from the table, instead it uses this formula in the Control Source: "=DateDiff("yyyy",[DOB],Date())" in order to calculate the age in years.
This works beautifully, except I need to validate the Age box using "<=14 And >=19" but this validation is ignored because the information is generated dynamically.
Can anyone please suggest a way of making this work, or possibly another way of approaching the problem.
I don't have very much experience with Access, so please be gentle
How shall I go about it
How shall I go about it?