Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculating Dates (Access 2003)

    I need to calculate a date as part of a query's criteria. The date I need to end up with is one year prior to the first day of the current month. For example, if I run the query today (11/20/08), the date I want to end up with as part of my criteria is 11/1/07. What I used is:

    <DateAdd("yyyy",-1,DatePart("m",Now()) & "/1/" & DatePart("yyyy",Now()))

    It works, but is there a cleaner way to do that?

    Thanks for your suggestions.

    Nancy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calculating Dates (Access 2003)

    You could use

    <DateSerial(Year(Date())-1,Month(Date()),1)

    or

    <DateAdd("yyyy",-1,Date()-Day(Date())+1)

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating Dates (Access 2003)

    Thanks, Hans, I'll try it.

    I appreciate your fast response.

    Nancy

Posting Permissions

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