On Jul 28, 12:03*pm, Keven Denen <keven.de...@gmail.com> wrote:
> On Jul 28, 11:55*am, Craig <cjohn...@gmail.com> wrote:
>
>
>
> > Table Structure:
>
> > Table: Siblings
> > SiblingID (PK)
> > ContactID (FK)
> > SiblingDOB
> > LastName
> > FirstName
> > SibSex
> > SibRace
> > EntryDate
> > CalculatedAge
> > Assessment (Is has to be calculated behind the scenes with an If/Then/
> > Else statement)
> > AssessmentComplete
> > Blah1
> > Blah2
> > Blah3
>
> > What I need to do:
>
> > 1) * * *I need to calculate their age using SiblingDOB and EntryDate behind
> > the scenes and store it in CalculatedAge.
> > 2) * * *I need to take the calculate age and create groups and store it in
> > Assessment. *So
> > a. * * *If calculatedage >=3 & calculatedage <=5 then Assessment = Test 1
> > b. * * *If calculatedage >=6 & calculatedage <=12 then assessment = Test 2
> > c. * * *If calculatedage >=13 & calcualtedage <=18 then assessment = Test 3
> > d. * * *Else = Error
>
> > How do I do this in access?
>
> > Thanks!
>
> You don't. Table fields should almost never contain calculated data.
> If you need to have access to those two pieces of data, use a query to
> calculate them and use the query as the data source for anything that
> needs to interact with it.
>
> Keven Denen
To calculate those in a query...
In a new column do:
CalculatedAge

ateDiff("yyyy", [SiblingDOB], Now())+ Int( Format(now
(), "mmdd") < Format( [SiblingDOB], "mmdd") )
then in another new column do:
Assessment: IIf([CalculatedAge]>=3 And [CalculatedAge]<=5,"Test 1",IIf
([CalculatedAge]>=6 And [CalculatedAge]<=12,"Test 2",IIf
([CalculatedAge]>=13 And [CalculatedAge]<=18,"Test 3","Error")))
Keven Denen