Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Location
    Cape Town
    Posts
    8

    Unanswered: working with dates

    hi guys

    i created a database with access and vba to track for a distribution company i work for, it is used to track repairs,

    i have a problem with calculating dates

    i store a date in the table in the date format, i now need to work out how to find all records between todays date using the now() and 2 weeks before without having to always restructure the query, and typing in the date 2 weeks before all the time.

    i had a look at the dateDiff, but it is not what I am looking for.

    any help would be great.

  2. #2
    Join Date
    May 2004
    Posts
    3
    You might create a function which return the current dat minus two weeks.
    In the query in the date field put in a condition something like:
    >=function() and <= date

    Should work like this

    Success

  3. #3
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    2WeeksAgoDate()-14)

    Date()-14 gives 4/5/04

    Now()-14 gives 4/05/2004 10:11:59 PM

    The 10:11:59 PM being Sydney Australia time

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    ... where somecol between dateadd("ww",-2,date()) and date()
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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