MS Access: IsDate Function
This MSAccess tutorial explains how to use the Access IsDate function with syntax and examples.
Description
The Microsoft Access IsDate function returns TRUE if the expression is a valid date. Otherwise, it returns FALSE.
Syntax
The syntax for the IsDate function in MS Access is:
IsDate ( expression )
Parameters or Arguments
- expression
- It is a variant.
Returns
The IsDate function returns TRUE if the expression is a valid date.
The IsDate function returns FALSE if the expression is not a valid date.
Applies To
The IsDate 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
Example
Let's look at how to use the IsDate function in MS Access:
IsDate (#1/3/2004#) Result: TRUE IsDate ("Tech on the Net") Result: FALSE IsDate ("January 3, 2004") Result: TRUE
Example in VBA Code
The IsDate function can be used in VBA code in Microsoft Access.
For example:
Dim LValue As Boolean LValue = IsDate("Tech on the Net")
In this example, the variable called LValue would contain FALSE as a value.
Example in SQL/Queries
You can also use the IsDate function in a query in Microsoft Access.
For example:
In this query, we have used the IsDate function as follows:
Expr1: IsDate([Description])
and
Expr2: IsDate(#03/01/2003#)
The first IsDate function will evaluate whether the Description field is a valid date and display the results in a column called Expr1. You can replace Expr1 with a column name that is more meaningful.
For example:
ValidDate: IsDate([Description])
The results would now be displayed in a column called ValidDate.
The second IsDate function will evaluate whether the value #03/01/2003# is a valid date and return the results in a column called Expr2.
Advertisements