M
MrMackey via AccessMonster.com
In a regualar calendar week 53 for 2009 is defined as Dec 27-Dec 02. Week 1
is defined as Jan 03 - Jan 09.
It seems to be impossible to get Access VBA to return the correct week for a
date in this period no matter how the last parameter (firstweekofyear) is set.
Both Format() and DatePart have this problem. If one of the sample dates work
below, then the other does not. Does anyone have a solution?
'******* CODE BEGIN **************
Public Sub TESTING()
Dim D As Date
Dim O As Integer
'D = #12/30/2009# ' should return 53
D = #1/6/2010# ' should return 1
O = DatePart("ww", D, vbSunday, 0)
MsgBox O
End Sub
'******* CODE END**************
Mr. Mackey
is defined as Jan 03 - Jan 09.
It seems to be impossible to get Access VBA to return the correct week for a
date in this period no matter how the last parameter (firstweekofyear) is set.
Both Format() and DatePart have this problem. If one of the sample dates work
below, then the other does not. Does anyone have a solution?
'******* CODE BEGIN **************
Public Sub TESTING()
Dim D As Date
Dim O As Integer
'D = #12/30/2009# ' should return 53
D = #1/6/2010# ' should return 1
O = DatePart("ww", D, vbSunday, 0)
MsgBox O
End Sub
'******* CODE END**************
Mr. Mackey