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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MyDay = last day of the month 2 month ago 1

Status
Not open for further replies.

teqtaq

Technical User
Nov 18, 2007
197
US
I want my table to be renamed with date that is 2 month ago with last day of that month.

My code

Dim myYear As Long
Dim myMonth As Long
Dim myDay As Long


myYear = Year(Date)
myMonth = Month(Date)
myDay = Day(Date)


DoCmd.Rename "TBL" & " " & Format(DateSerial(myYear, myMonth - 2, myDay), "mm_dd_yyyy"), acTable, "TBLPrior"

So far I am getting it except MyDay wich is today's day.

Thanks
 
hi,

LastDay2MonthsAgo = DateSerial(year(date),Month(date)-1,0)

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top