Ever needed to calculate the first and last day of the month? Here's an expression that can be used in Access:
DateSerial(Year(Now), Month(Now) + 1, 0) - Last day of month
DateSerial(Year(Now), Month(Now), 1) - First day of month
Subscribe to:
Post Comments (Atom)
15 comments:
oh, that's so pretty. Thank you!
Lorence
LorencesKitchen.blogspot.com
LorenceSing.com
Wicked. Thanks a lot for that.
Thanks for posting this...Saved me tons of time.
Solved a million problems and saved me so much time! Thank you!
The coolest thing about this is the fact this same syntax works in SQL Server Reporting Services 2008 for specifying the default values for parameters in terms of dates. I used this exact same syntax to find the first day of the month and the last day of the month and it worked nicely.
Cheers to you!
THANK YOU!!!!!!!!!!!!!!!!
Very Good. Thank you!
Perfect! Huge time saver, thank you!
Thank you
Tried this in access with now value and it worked, then replaced with my own date field value and I got errors where I had null dates. I will probably figure out how to solve the null dates bit but thought i'd let you know.
To handle null values in Access use Nz(Date, "ValueToUse")
Can this be modified for the previous month?
Very Good. Saved me a lot of time. Thank you very much - Binu
AWSOME!! Thanks!
Post a Comment