Public Function MonLastDay(dFirst As Date) As Date Dim dm As Date Dim m As Integer dm = dFirst m = Month(dm) Do While Month(dm) = m dm = dm + 1 Loop MonLastDay = dm - 1 End Function |
下面是由access中国的李啸林版主提供:
Public Function MonLastDay1(dFirst As Date) As Date MonLastDay1 = DateAdd("d", -1, CDate(DatePart("yyyy", DateAdd("m", 1, dFirst)) & _ "-" & DatePart("m", DateAdd("m", 1, dFirst)))) End Function |
下面是由access中国的AlexLiu提供:
Public Function MonLastDay1(dFirst As Date) As Date MonLastDay1 = DateSerial(Year(dFirst), Month(dFirst) + 1, 1) - 1 End Function |