In this tutorial you will learn how to use the DatePart Function.
The DatePart function returns a String indicating the specified day of the week.
=DatePart( interval, date [, firstdayofweek] [, firstweekofyear] )
interval a String expression that is the interval of time you want to return.
date a value that represents a valid date, be that numeric or string also.
firstdayofweek a constant specifying the first day of the week.
firstweekofyear a constant specifying the first week of the year.
The result is 44.
There is no WeekNum function in Access like Excel has.
UK Date Format
Settings
Interval
Setting
Description
yyyy
Year
q
Quarter
m
Month
y
Day of Year
d
Day
w
WeekDay
ww
Week
h
Hour
n
Minute
s
Second
FirstDayOfWeek
Constant
Value
Description
vbUseSystem
0
First day of week specified in system settings (default)
vbSunday
1
Sunday
vbMonday
2
Monday (complies with ISO standard 8601, section 3.17)
vbTuesday
3
Tuesday
vbWednesday
4
Wednesday
vbThursday
5
Thursday
vbFriday
6
Friday
vbSaturday
7
Saturday
FirstWeekOfYear
Constant
Value
Description
vbUseSystem
0
Use System Settings
vbFirstJan1
1
Start with week in which January 1 occurs (default)
vbFirstFourDays
2
Start with the first week that has at least four days in the new year
vbFirstFullWeek
3
Start with first full week of the year
FORM
In a Form you could set the Default Value of a Textbox to
=DATEPART("ww", #2/11/2012#)
VBA
In a Form add a TEXTBOX control and rename it "txtDatePart", then you could add the following in the Load Event.
Private Sub Form_Load()
txtDatePart = DatePart("ww", #2/11/2012#)
End Sub