How can I get the last second of the last month as a default parameter value?
0
votes
1
answer
1068
views
I am trying to get the last second of the last month as a default value for a parameter. I can get the last day of the last month from this query on social.msdn.microsoft.com
> last month last day expression:
DateValue(DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now)))
The about would return 12am of the last day of the month. Starting with that I made one change so that I can get the last second of the last month.
=DateValue(DateAdd("S",-1,DateAdd("D",-(Day(Now)-1),Now)))
That does not work though as the time is still set to midnight.
How do I get the last second of the last month as a datetime value?
---
This has no affect on underlying queries that deal with report data. This is purely about showing an end user the start and end dates in a report header. "9/1/2018 00:00:00 to 9/30/2018 11:59:59" "9/1/2018 00:00:00 to 10/1/2018 00:00:00". The former example to my end users is clearer that the data is in the month where as seeing number for the next month (like in the second example) is ... unsettling
Asked by Matt
(365 rep)
Oct 18, 2018, 02:28 PM
Last activity: Aug 17, 2022, 09:09 PM
Last activity: Aug 17, 2022, 09:09 PM