Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Apr 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculating Dates (Access 97 SR-2)

    I'm sure this is very simple, but I'm a neophyte. I have a query that contains a field for date of birth. I want to add a field to also show the date of the 75th birthday (DOB+75 years=dd/mm/yyyy. I'm afraid my syntax leaves something to be desired!

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Calculating Dates (Access 97 SR-2)

    Yes - it's a function in Access called DateAdd which lets you do all sorts of things to dates. The syntax is:
    DateAdd("y",+75,[DOB])
    You can use this in queries, in code or whatever. The plus sign is optional, but you can subtract if you wish by making it negative.

    Good Luck
    Wendell Bell
    Access-Experts.com
    Wendell

  3. #3
    New Lounger
    Join Date
    Apr 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating Dates (Access 97 SR-2)

    Wendell - thanks for taking the time to answer my question. I tried your suggestion, but the durn thing kept adding 75 DAYS to the DOB even though I used "y", which was the result of all the other ways I'd already tried to get what I wanted.

    After considerable brain wracking, I realized that the designation for years is "yyyy". That, plus your DateAdd hint, is working like a champ. Thanks again.

    RK <img src=/S/groovin.gif border=0 alt=groovin width=21 height=21>

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Calculating Dates (Access 97 SR-2)

    You are most welcome.
    Wendell

Posting Permissions

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