One month back from 30 September is 30 August, not 31 August.
If you want the last day of the previous month, you could use this
expression:
DateSerial(Year(Date()), Month(Date()), 0)
But that won't give you a "31-day difference" for all dates.
I tried playing with some variations of date calculations, trying to use the
number of days that the current date is from the last day of the current
month, and then applying that to the previous month, but when the two months
have different number of days, the resulting date is too far back or not far
back. I can envision setting up a complicated expression that compares the
number of days in each of the months, and then setting an upper and lower
limit to the one-month back date, but I'm not convinced that it would
work...and you'd need to make a decision about the logic to be used:
namely, do you always count the number of days that the current date is from
the first of the month, or from the last of the month? You can get a
different answer depending upon which direction you go.
If you can identify which date you want as the result (when going back one
month) for the following examples, I probably can come up with an expression
that will work for you:
Start Dates
---------------
12/31/2003
2/24/2003
10/2/2003
3/11/2003
--
Ken Snell
<MS ACCESS MVP>
Jacob Frankham said:
Thanks Ken
What about if I wanted to deduct 1 month?
I tried DateAdd("m", -1 [myDate]) on a date set to 30.09.03 but it