Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010

    Unanswered: access 2003 question

    Hi everyone, I have a question about an access database I built for a sports group. I am interested in the value in one field (plbday) (players birthday), and having this value, it is in format mm/dd/yyyy, set as a date/time, display one of 6 values (pldivision), the age based divisions. Can this be done to automatically display this value based on the age(year of birth is all that is used)? Can it be done as a querry to set the value?
    eg: if the child is born in 2000 or 2001 it should display Squirt.
    Can this work so that the as the child ages they will go to the next division?
    ie: squirt age is 10 & 11, Peewee 12 &13. can this calculate from the current year?

  2. #2
    Join Date
    Jan 2010
    are you doing this in a query? if so, then use the datediff function inside an iif statement, like this:

    iif(DateDiff("yyyy", Now(), [plbday])<11,"Squirt","Peewee") As Division

    you try placing that in the query builder, the datediff will calculate the difference in years from plbday to today's date, that will give you the age of the child, once you get the age, if there are just 2 divisions, use an iif statement, anything less than 11 then you assign "Squirt" to the field, otherwise Peewee. What you need is definitely the datediff function to calculate the difference in years

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts