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

date change

Status
Not open for further replies.

ciarra41

Technical User
Sep 11, 2006
116
US
recently I've always pulled data from the previous month. because of the new year I'm getting the error message it's out of range. How can I get it to back to DEC.08 now that were in Jan.09. It worked find just going back one month how can it go back to DEC.08


strName = UCase(MonthPeriod(Month(Date) - 1))
 
Take a look at the "DateDiff" statement.

_________________
Bob Rashkin
 
Have a look at the DateAdd() function, something like:
Code:
Format(DateAdd("m", -1, Date), "mmm-yyyy")
I've also included Format to, well er, format the output. You can obviously change that as required.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top