Group:  Microsoft Access ยป microsoft.public.access.gettingstarted
Thread: Calculating the league age based on an end date

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

Calculating the league age based on an end date
"jdub via AccessMonster.com" <u22625[ at ]uwe> 18.07.2006 22:45:05
Hey group!!

I need some help. I've been tasked to calculate the age of players from
1/1/2006. I created a field in my registration table called "enddate" and
gave it a default value of "1/1/2006." During registration, the user enters
the Date of Birth and it calculates the players league age. The formula I'm
using is: =Int(DateDiff("m",[DOB],[EndDate])/12).

The problem I'm having is that it works for every player except the ones in
January. What I would like to do is expand this to include the day as well.
Presently, the formula only has "m" for month. Please help. I'm a newbie
and happened to stumble across the above formula online but can't remember
where.

thanks,

Jdub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200607/1
Re: Calculating the league age based on an end date
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 18.07.2006 22:57:02
DateDiff("yyyy", [DOB], #1/1/2006#) - IIf(Format([DOB], "mmdd") > "0101", 1,
0)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"jdub via AccessMonster.com" <u22625[ at ]uwe> wrote in message
news:637360255fd56[ at ]uwe...
[Quoted Text]
> Hey group!!
>
> I need some help. I've been tasked to calculate the age of players from
> 1/1/2006. I created a field in my registration table called "enddate" and
> gave it a default value of "1/1/2006." During registration, the user
> enters
> the Date of Birth and it calculates the players league age. The formula
> I'm
> using is: =Int(DateDiff("m",[DOB],[EndDate])/12).
>
> The problem I'm having is that it works for every player except the ones
> in
> January. What I would like to do is expand this to include the day as
> well.
> Presently, the formula only has "m" for month. Please help. I'm a newbie
> and happened to stumble across the above formula online but can't remember
> where.
>
> thanks,
>
> Jdub
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200607/1


Re: Calculating the league age based on an end date
"jdub via AccessMonster.com" <u22625[ at ]uwe> 19.07.2006 02:41:24
Thanks Douglas,

I'm receiving a Syntax error (comman) in query expression message when I run
the report.

Douglas J. Steele wrote:
[Quoted Text]
>DateDiff("yyyy", [DOB], #1/1/2006#) - IIf(Format([DOB], "mmdd") > "0101", 1,
>0)
>
>> Hey group!!
>>
>[quoted text clipped - 17 lines]
>>
>> Jdub

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200607/1
Re: Calculating the league age based on an end date
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 19.07.2006 10:35:42
I can't see how that calculation could be causing a syntax error.

Does the query run on its own, and it's only the report that complains, or
do you get the error running the query as well?

If you get the error running the query, what's the SQL for your query (open
the query in design mode, select SQL View from the View menu, copy the SQl
and paste it here).

If it's strictly the report, do you have calculations as the control source
for any of the text boxes?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"jdub via AccessMonster.com" <u22625[ at ]uwe> wrote in message
news:637570991d408[ at ]uwe...
[Quoted Text]
> Thanks Douglas,
>
> I'm receiving a Syntax error (comman) in query expression message when I
run
> the report.
>
> Douglas J. Steele wrote:
> >DateDiff("yyyy", [DOB], #1/1/2006#) - IIf(Format([DOB], "mmdd") > "0101",
1,
> >0)
> >
> >> Hey group!!
> >>
> >[quoted text clipped - 17 lines]
> >>
> >> Jdub
>
> --
> Message posted via AccessMonster.com
>
http://www.accessmonster.com/Uwe/Forums.aspx/access-gettingstarted/200607/1


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