Results 1 to 2 of 2
  1. #1
    Macarena is offline Novice
    Windows 8 Access 2013
    Join Date
    Apr 2014
    Posts
    1

    Exclamation Date Query

    Hi, First of all, I'm sorry if my english is bad, I'm from israel.



    I want to make a query that checks if someone is 3 years old. I have his birthday and I need to check this:

    actual date right now - 3 years >= birthday

    how can I do it?

  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,771
    Use DateDiff function.

    SELECT * FROM tablename WHERE DateDiff("yyyy",[BirthDate],Date())>=3;

    How precise do you need this calculation? Even if birthdate is in July, that year will be counted as full year. DateDiff rounds. The following will calculate fraction of year.

    DateDiff("m",[BirthDate],Date())/12
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-11-2014, 07:32 PM
  2. Replies: 5
    Last Post: 12-12-2013, 12:14 PM
  3. Replies: 1
    Last Post: 05-09-2013, 09:13 AM
  4. Replies: 3
    Last Post: 09-19-2012, 08:59 AM
  5. Replies: 3
    Last Post: 08-21-2012, 03:05 PM

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