Home Privacy Policy Feedback Link to us Site Map Forums

Access: Year Function


In Access, the Year function returns a four-digit year (a number from 1900 to 9999) given a date value.

The syntax for the Year function is:

Year ( date_value )

date_value is a valid date.


For example:

Year (#22/11/2003#) would return 2003
Year (#01/01/1998#) would return 1998

VBA Code

The Year function can be used in VBA code. For example:

Dim LYear As Integer

LYear = Year(#12/03/2001#)

In this example, the variable called LYear would now contain the value of 2001.


SQL/Queries

You can also use the Year function in a query.