MS Access: CDate Function
In Microsoft Access, the CDate function converts a value to a date.
Syntax
The syntax for the CDate function is:
CDate( expression )
expression is the value to convert to a date.
Applies To
- Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000
VBA Code
The CDate function can be used in VBA code. For example:
Dim LstrDate As String Dim LDate As Date LstrDate = "Apr 6, 2003" LDate = CDate(LstrDate)
The function called "CDate" will convert any value to a date as long as the expression is a valid date.
In this example, the variable LDate would now contain the value 4/6/2003.