Results 1 to 3 of 3

Thread: Month end

  1. #1
    Join Date
    Dec 2003
    Location
    New York
    Posts
    47

    Unanswered: Month end

    I am trying to determine the last day of a month based on the first day of the month. I am also trying to calculate the number of days left in the month from a given date to the end of the month. I need to do this in a query as opposed to in code.

    Thanks
    Terri
    Terri Gavin

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Best way to do it is to use the DateAdd function to subtract one day from the first day of the NEXT month.

    No time to test, but it's something like:

    LastDay: DateAdd("d", -1, DateSerial(1, Month(DateAdd("m",+1,[DateField])), Year(DateAdd("m",+1,[DateField])))

    Something like that anyway ^^

    This question has recently been asked and answered too, so you might want to try searching through the topics here to confirm
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    A good reference for things like this:

    http://www.pacificdb.com.au/MVP/Code/Dates.htm
    Paul

Posting Permissions

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