|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
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.
|
|
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. >
|
|
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. > > > > >
|
|
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. >> > >> >> >>
|
|
|