Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Access 2003 - calculating age

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Access 2003 - calculating age
B. Levien 28.09.2006 14:44:01
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.

Re: Access 2003 - calculating age
"Duane Hookom" <DuaneAtNoSpanHookomDotNet> 28.09.2006 19:19:28
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" <BLevien[ at ]discussions.microsoft.com> wrote in message
news:C8182084-20D5-4D3A-927F-77C1456B0381[ at ]microsoft.com...
[Quoted Text]
>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.
>


Re: Access 2003 - calculating age
B. Levien 29.09.2006 14:19:02
At this moment ... after generating my "age report" ... you are my most
favourite person in the world!!!!!

Thank you!!!!

Brenda

"Duane Hookom" wrote:

[Quoted Text]
> 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" <BLevien[ at ]discussions.microsoft.com> wrote in message
> news:C8182084-20D5-4D3A-927F-77C1456B0381[ at ]microsoft.com...
> >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.
> >
>
>
>
Re: Access 2003 - calculating age
"Duane Hookom" <DuaneAtNoSpanHookomDotNet> 29.09.2006 18:03:34
Glad to hear you got this working.


--
Duane Hookom
MS Access MVP

"B. Levien" <BLevien[ at ]discussions.microsoft.com> wrote in message
news:39DDB2AD-CFBF-46BD-8783-1E39A3FF5396[ at ]microsoft.com...
[Quoted Text]
> At this moment ... after generating my "age report" ... you are my most
> favourite person in the world!!!!!
>
> Thank you!!!!
>
> Brenda
>
> "Duane Hookom" wrote:
>
>> 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" <BLevien[ at ]discussions.microsoft.com> wrote in message
>> news:C8182084-20D5-4D3A-927F-77C1456B0381[ at ]microsoft.com...
>> >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.
>> >
>>
>>
>>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net