Tags: access, code, database, givendate, microsoft, mysql, oracle, sql, vba

Last day of the month

On Database » Microsoft Access

4,465 words with 6 Comments; publish: Mon, 31 Dec 2007 00:24:00 GMT; (25062.50, « »)

What's the best way in vba code to get the last day of the month for a given

date, i.e.

12/01/2004 gives 12/31/2004

12/14/2004 gives 12/31/2004

12/31/2004 gives 12/31/2004

?

Robert

All Comments

Leave a comment...

  • 6 Comments
    • "Robert" <projecttoday.ms-access.todaysummary.com.yahoo.com> wrote in message

      news:3wZvd.2102$4_1.1062.ms-access.todaysummary.com.fe07.lga...

      > What's the best way in vba code to get the last day of the month for a

      given

      > date, i.e.

      > 12/01/2004 gives 12/31/2004

      > 12/14/2004 gives 12/31/2004

      > 12/31/2004 gives 12/31/2004

      LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

      --

      I don't check the Email account attached

      to this message. Send instead to...

      RBrandt at Hunter dot com

      #1; Mon, 31 Dec 2007 00:25:00 GMT
    • Robert wrote:

      > What's the best way in vba code to get the last day of the month for a given

      > date, i.e.

      > 12/01/2004 gives 12/31/2004

      > 12/14/2004 gives 12/31/2004

      > 12/31/2004 gives 12/31/2004

      Best, best...

      Function monthEnd(dIn as date)as date

      monthend=dateserial(year(din),month(din)+1,0)

      end function

      --

      Bas Cost Budde, Holland

      http://www.heuveltop.nl/BasCB/msac_index.html

      I prefer human mail above automated so in my address

      replace the queue with a tea

      #2; Mon, 31 Dec 2007 00:26:00 GMT
    • Thank you. This is helpful.

      "Rick Brandt" <rickbrandt2.ms-access.todaysummary.com.hotmail.com> wrote in message

      news:32b8ckF3kj0clU1.ms-access.todaysummary.com.individual.net...

      > "Robert" <projecttoday.ms-access.todaysummary.com.yahoo.com> wrote in message

      > news:3wZvd.2102$4_1.1062.ms-access.todaysummary.com.fe07.lga...

      >> What's the best way in vba code to get the last day of the month for a

      > given

      >> date, i.e.

      >> 12/01/2004 gives 12/31/2004

      >> 12/14/2004 gives 12/31/2004

      >> 12/31/2004 gives 12/31/2004

      > LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

      > --

      > I don't check the Email account attached

      > to this message. Send instead to...

      > RBrandt at Hunter dot com

      #3; Mon, 31 Dec 2007 00:27:00 GMT
    • Thank you. dateserial is the best way.

      "Bas Cost Budde" <b.costbudde.ms-access.todaysummary.com.heuvelqop.nl> wrote in message

      news:cpppuo$ftk$2.ms-access.todaysummary.com.news2.solcon.nl...

      > Robert wrote:

      >> What's the best way in vba code to get the last day of the month for a

      >> given date, i.e.

      >> 12/01/2004 gives 12/31/2004

      >> 12/14/2004 gives 12/31/2004

      >> 12/31/2004 gives 12/31/2004

      > Best, best...

      > Function monthEnd(dIn as date)as date

      > monthend=dateserial(year(din),month(din)+1,0)

      > end function

      > --

      > Bas Cost Budde, Holland

      > http://www.heuveltop.nl/BasCB/msac_index.html

      > I prefer human mail above automated so in my address

      > replace the queue with a tea

      #4; Mon, 31 Dec 2007 00:29:00 GMT
    • Thank you.

      "Rick Brandt" <rickbrandt2.ms-access.todaysummary.com.hotmail.com> wrote in message

      news:32b8ckF3kj0clU1.ms-access.todaysummary.com.individual.net...

      > "Robert" <projecttoday.ms-access.todaysummary.com.yahoo.com> wrote in message

      > news:3wZvd.2102$4_1.1062.ms-access.todaysummary.com.fe07.lga...

      >> What's the best way in vba code to get the last day of the month for a

      > given

      >> date, i.e.

      >> 12/01/2004 gives 12/31/2004

      >> 12/14/2004 gives 12/31/2004

      >> 12/31/2004 gives 12/31/2004

      > LastDayOfMonth: DateSerial(Year(DateField), Month(DateField) + 1, 0)

      > --

      > I don't check the Email account attached

      > to this message. Send instead to...

      > RBrandt at Hunter dot com

      #5; Mon, 31 Dec 2007 00:30:00 GMT
    • Thank you.

      "Bas Cost Budde" <b.costbudde.ms-access.todaysummary.com.heuvelqop.nl> wrote in message

      news:cpppuo$ftk$2.ms-access.todaysummary.com.news2.solcon.nl...

      > Robert wrote:

      >> What's the best way in vba code to get the last day of the month for a

      >> given date, i.e.

      >> 12/01/2004 gives 12/31/2004

      >> 12/14/2004 gives 12/31/2004

      >> 12/31/2004 gives 12/31/2004

      > Best, best...

      > Function monthEnd(dIn as date)as date

      > monthend=dateserial(year(din),month(din)+1,0)

      > end function

      > --

      > Bas Cost Budde, Holland

      > http://www.heuveltop.nl/BasCB/msac_index.html

      > I prefer human mail above automated so in my address

      > replace the queue with a tea

      #6; Mon, 31 Dec 2007 00:30:00 GMT