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

Can I get it??

Status
Not open for further replies.

site

Programmer
Oct 23, 2001
44
AT
Hi, friends,

I have a report title:

" Summary of 2001 Receipt Transactions

July 1, 2001 Thru July 31, 2001 "

I want to know how to get "July( currentMonth - 1) and LastDate of this Month.

Can help me get it?

Many Thanks.
Jing
 
Actually, either is trivial in VBA.

Given Some Month within a valid date (e.g. #8/9/2001# | Now) refered to as a FIELD [MyDate]:

FirstMonth: DateSerial(Year([MyDate]), Month([MyDate]), 1)

LastMonth: DateSerial(Year([MyDate]), Month([MyDate]) + 1, 0)

If you want to do it in a module, so the dates are 'consistient':

FirstMonth = DateSerial(Year(Now), Month(Now), 1)

LastMonth = DateSerial(Year(Now), Month(Now) + 1, 0)

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top