Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Day of Current Month 2

Status
Not open for further replies.

EllieFant

MIS
May 15, 2001
513
0
0
US
I want to print on my report

"Please return this document to the Secretary by [last day of the current month]"

How do I get access to calculate what that date is? I am sure it is super easy.
Ellie
**Using Access 97**

lena.wood@wgint.com (work)
elliefant@starband.net (home)
 
Paste the following into a VBA module or add it to the general code directly in the report:

Public Function LastDay() As Date
Dim CurrMM As Integer
Dim Today As Date
Today = Date
CurrMM = DatePart("m", Today)
Do Until DatePart("m", Today) > CurrMM
Today = DateAdd("d", 1, Today)
Loop
LastDay = DateAdd("d", -1, Today)
End Function

On your report add an unbound text box with the following controlsource:
="Please return this document to the Secretary by " & LastDay()
 
This from an MS Knowledge Base article that I keep citing...

The last day of the current month:

[tt]
DateSerial(Year(Date()), Month(Date()) + 1, 0)
[/tt] Jeff Roberts
Analysis, Design, & Implementation
RenaissanceData.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top