Results 1 to 12 of 12
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    within 3

    All. I have a table with names and birthdates. I need to get a list of all people who are turning 65 within 3 months, 2 months and now. I started out with criteria "dob >90 days". I am drawing a blank. Please help.


    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Use DateDiff() function to calculate the date they will be 65. Might find this of interest https://www.accessforums.net/access/...age-34321.html

    Apply criteria to that constructed field:

    Between Date() AND Date()+90
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Ok. Thanks I got it. My code:
    Code:
    Age: Int((Now()+90-[DateofBirth])/365.25)
    This gets me people who would be 65 within 3 months.

  4. #4
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Ok I thought I had it but it still doent work. Please help. thanks

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Did you try the suggestion I offered? I said calculate date, not age.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Sorry; I'm not following. I thought I was calculating date.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The expression you posted is calculating age. Since it returns whole number (years), could apply criteria to that constructed field: =65

    However, since it is returning only the integer part, it will retrieve all records where the result is 65, even if birthday is 5 months from now.

    Remove the Int() function and try criteria of: BETWEEN 65 AND 65.25
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    So; Like this: Expr1: ((Now()+90-[DateofBirth])/365.25) with a criteria of Between 65 and 65.25. Still does get me anyone and I know there's at least l person. What am I doing wrong?

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Works for me. Post the SQL statement of attempted query.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    I got it this time. It returns the records I need and the Expr: returns 65.08..... What is this?Thanks so much.
    Code:
    SELECT tblARM1.ClientID, tblARM1.CSR, tblARM1.EEID, tblARM1.PolicyHolderSSN, tblARM1.DependentSSN, tblARM1.FirstName, tblARM1.LastName, tblARM1.Address1, tblARM1.Address2, tblARM1.City, tblARM1.Phone, tblARM1.State, tblARM1.Zip, tblARM1.ParticipantType, tblARM1.CoverageLevel, tblARM1.PlanName, tblARM1.ClientRate, tblARM1.TotalRate, tblARM1.EERate, tblARM1.DateofBirth, tblARM1.Age, ((Now()+90-[DateofBirth])/365.25) AS Expr1
    FROM tblARM1
    WHERE (((((Now()+90-[DateofBirth])/365.25)) Between 65 And 65.25));

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Your question: What is this? - refers to what? Expr1 name or the number 65.08?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Sorry. This indicates a field I used to return the age or the time it takes to 65 within three months. I guess these are what the numbers stand for. Thanks

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums