Access 2007-2019
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
 
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
 
Glossary

New Entries Added Almost Daily!
Click here to get on our Mailing List

   

   Access    Excel    Word    Windows    HTML

 
MS Access

DatePart

Using the DATEPART Function

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.

DatePart - Function Engine

The result is 44.

There is no WeekNum function in Access like Excel has.
UK Date Format

Settings
Interval
SettingDescription
yyyyYear
qQuarter
mMonth
yDay of Year
dDay
wWeekDay
wwWeek
hHour
nMinute
sSecond

FirstDayOfWeek
ConstantValueDescription
vbUseSystem0First day of week specified in system settings (default)
vbSunday1Sunday
vbMonday2Monday (complies with ISO standard 8601, section 3.17)
vbTuesday3Tuesday
vbWednesday4Wednesday
vbThursday5Thursday
vbFriday6Friday
vbSaturday7Saturday

FirstWeekOfYear
ConstantValueDescription
vbUseSystem0Use System Settings
vbFirstJan11Start with week in which January 1 occurs (default)
vbFirstFourDays2Start with the first week that has at least four days in the new year
vbFirstFullWeek3Start 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
	

Course

Access 2013 Access Expert 12

Seminars

Access 2010 Access SQL 2

Search

You can find more about this by searching the website.


Alex Hedley (Avatar) By: Alex Hedley


Click here to sign up for more FREE tips

 

You may want to read these articles from the 599CD News:

 

Learn
 
Accessindex
Excelindex
Wordindex
Windowsindex
PowerPointindex
Photoshopindex
Visual Basicindex
ASPindex
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About Us
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Gift CDs
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP