Access 2003 - calculating age

G

Guest

I need to calculate age in a report.

I have one table with the following fields "FirstName", "LastName", "Age"
and "Birthday". The Age column is blank.

I created a report using all the fields in that table.

I have tried to use the expressions that others have written in some of the
previous postings, but I cannot get them to work.

As an example, I tried putting the following as the control source under age:

=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),
"mmdd"),1,0)

Note: I did change the formula to try to take the information from my table:

=DateDiff("yyyy",[Ages]![Birthday],Date())-IIf(Format([Ages]![Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)

When I view my report, I get a dialog box which states "Enter Parameter
Value" (I don't know what this means exactly).

I tried adding two unbound text boxes as per the suggestion in Microsoft
Office Online and setting the name property for one box to Birthdate and the
other to Age, etc.

I do not know what I am doing wrong.

Any assistance would be greatly appreciated.
 
D

Duane Hookom

First, don't include the table name in your expression.
=DateDiff("yyyy",[Birthday],Date())-IIf(Format([Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)
Then make sure the name of your text box is not the name of a field.
 
G

Guest

At this moment ... after generating my "age report" ... you are my most
favourite person in the world!!!!!

Thank you!!!!

Brenda

Duane Hookom said:
First, don't include the table name in your expression.
=DateDiff("yyyy",[Birthday],Date())-IIf(Format([Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)
Then make sure the name of your text box is not the name of a field.

--
Duane Hookom
MS Access MVP


B. Levien said:
I need to calculate age in a report.

I have one table with the following fields "FirstName", "LastName", "Age"
and "Birthday". The Age column is blank.

I created a report using all the fields in that table.

I have tried to use the expressions that others have written in some of
the
previous postings, but I cannot get them to work.

As an example, I tried putting the following as the control source under
age:

=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),
"mmdd"),1,0)

Note: I did change the formula to try to take the information from my
table:

=DateDiff("yyyy",[Ages]![Birthday],Date())-IIf(Format([Ages]![Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)

When I view my report, I get a dialog box which states "Enter Parameter
Value" (I don't know what this means exactly).

I tried adding two unbound text boxes as per the suggestion in Microsoft
Office Online and setting the name property for one box to Birthdate and
the
other to Age, etc.

I do not know what I am doing wrong.

Any assistance would be greatly appreciated.
 
D

Duane Hookom

Glad to hear you got this working.


--
Duane Hookom
MS Access MVP

B. Levien said:
At this moment ... after generating my "age report" ... you are my most
favourite person in the world!!!!!

Thank you!!!!

Brenda

Duane Hookom said:
First, don't include the table name in your expression.
=DateDiff("yyyy",[Birthday],Date())-IIf(Format([Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)
Then make sure the name of your text box is not the name of a field.

--
Duane Hookom
MS Access MVP


B. Levien said:
I need to calculate age in a report.

I have one table with the following fields "FirstName", "LastName",
"Age"
and "Birthday". The Age column is blank.

I created a report using all the fields in that table.

I have tried to use the expressions that others have written in some of
the
previous postings, but I cannot get them to work.

As an example, I tried putting the following as the control source
under
age:

=DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),
"mmdd"),1,0)

Note: I did change the formula to try to take the information from my
table:

=DateDiff("yyyy",[Ages]![Birthday],Date())-IIf(Format([Ages]![Birthday],"mmdd")>Format(Date(),"mmdd"),1,0)

When I view my report, I get a dialog box which states "Enter Parameter
Value" (I don't know what this means exactly).

I tried adding two unbound text boxes as per the suggestion in
Microsoft
Office Online and setting the name property for one box to Birthdate
and
the
other to Age, etc.

I do not know what I am doing wrong.

Any assistance would be greatly appreciated.
 

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