end of Month Function

R

RobFMS

Here's a simple example (done in the immediate window):

? cDate("3/1/2004") - 1
2/29/2004

cDate() converts the text to a date. In this case, if you want to know what
the last day of the month for February is, then set it for the first day of
the following month and then back up 1 day.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
J

John Vinson

Is there a function in access similar to EOMonth "end of
month" In excel

There is now:

Public Function EOMonth(dtDate As Variant) As Variant
If Not IsNull(dtDate) Then
EOMonth = DateSerial(Year(dtDate), Month(dtDate) + 1, 0)
End If
End Sub


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
D

Douglas J. Steele

John Vinson said:
There is now:

Public Function EOMonth(dtDate As Variant) As Variant
If Not IsNull(dtDate) Then
EOMonth = DateSerial(Year(dtDate), Month(dtDate) + 1, 0)
End If
End Sub

Not quite, John.

From Excel help:

Returns the serial number date for the last day of the month that is the
indicated number of months before or after start_date. Use EOMONTH to
calculate maturity dates or due dates that fall on the last day of the
month.

Syntax

EOMONTH(start_date,months)

Start_date is a date that represents the start date.

Months is the number of months before or after start_date. A positive
value for months yields a future date; a negative value yields a past date.

However, this question was multiposted, and I'm sure I answered it correctly
in one of the (many) other newsgroups to which it was posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top