J
JayDe
I have some code where I calculate this month minus 2 month. This goes fine
until I get to august. When I use DateSerial to deduct 2 month I get to July,
and this makes no sence. I made the following testcode.
Sub StrangeMonth()
Dim MyDate As Date
MyDate = #8/31/2010#
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 1, Day(MyDate))) ' MsgBox = 7
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 2, Day(MyDate))) ' MsgBox = 7
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 3, Day(MyDate))) ' MsgBox = 5
End Sub
Can anyone test if they get the same result. I work on a Norwegian version
of Access 2007
If the same result turns upp in other computers. Is there a workaround?
Regards
JayDe
until I get to august. When I use DateSerial to deduct 2 month I get to July,
and this makes no sence. I made the following testcode.
Sub StrangeMonth()
Dim MyDate As Date
MyDate = #8/31/2010#
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 1, Day(MyDate))) ' MsgBox = 7
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 2, Day(MyDate))) ' MsgBox = 7
MsgBox DatePart("m", DateSerial(Year(MyDate), _
Month(MyDate) - 3, Day(MyDate))) ' MsgBox = 5
End Sub
Can anyone test if they get the same result. I work on a Norwegian version
of Access 2007
If the same result turns upp in other computers. Is there a workaround?
Regards
JayDe