please Help for date function

affan

Registered User.
Local time
Yesterday, 16:12
Joined
Jan 16, 2014
Messages
10
Dear all,

Please correct me whether below code is correct or not, i need previous month in text box.

Me!BeginDate = CDate("01/" & Month(Date) & "/" & Year(Date))
Me!EndDate = DateAdd("d", -1, DateAdd("m", 1, Me!BeginDate))

Your help will be highly appreciated.
 
EndDate = DateAdd("m", 1, Me.BeginDate)

The above should add I month to BeginDate and put that value into EndDate.

In order to help more I would need to know more about line one.

Please advise when this value will be calculated. e.g. Open of a Record, Adding some Data etc. Where do you get the start value.


 
dear rainlover,

thanks for your quickly reply

Start value and end value i am using for Report. when i take report
current month , previous month
 
current month:
start dateserial(year(date()), Month(date()), 1)
end dateserial(year(date()), Month(date())+1, 0)
Last month
start dateserial(year(date()), Month(date())-1, 1)
end dateserial(year(date()), Month(date())+0, 0)
 
dear rainlover,

thanks for your quickly reply

Start value and end value i am using for Report. when i take report
current month , previous month

So if you run the report today what would the Start and End dates be.

( For future notice ) Today is 18 January 2014.
 
current month:
start dateserial(year(date()), Month(date()), 1)
end dateserial(year(date()), Month(date())+1, 0)
Last month
start dateserial(year(date()), Month(date())-1, 1)
end dateserial(year(date()), Month(date())+0, 0)

thank you very much sir
 

Users who are viewing this thread

Back
Top Bottom