MS Access: Date Function
This MSAccess tutorial explains how to use the Access Date function with syntax and examples.
Description
The Microsoft Access Date function returns the current system date.
Syntax
The syntax for the Date function in MS Access is:
Date ()
Parameters or Arguments
There are no parameters or arguments for the Date function.
Returns
The Date function returns a date value that represents the current system date.
Applies To
The Date function can be used in the following versions of Microsoft Access:
- Access 2019, Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
Prerequisites
Example
Let's look at how to use the Date function in MS Access:
Date() Result: '22/11/2003' (your value will differ as it is the current system date)
Example in VBA Code
The Date function can be used in VBA code in Microsoft Access.
For example:
Dim LDate As String LDate = Date
In this example, the variable called LDate would now contain the current system date.
Example in SQL/Queries
You can also use the Date function in a query in Microsoft Access.
For example:
In this query, we have used the Date function as follows:
Expr1: Date()
This query will return the current system date and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.
For example:
CurrentDate: Date()
The results would now be displayed in a column called CurrentDate.
Advertisements