Applies ToAccess for Microsoft 365 Access 2024 Access 2021 Access 2019 Access 2016

Returns a Boolean value indicating whether an expression can be evaluated as a number.

Syntax

IsNumeric ( expression )

The required expressionargument is a Variant containing a numeric expression or string expression.

Remarks

IsNumeric returns True if the entire expression is recognized as a number; otherwise, it returns False.

IsNumeric returns False if expression is a date expression.

Query examples

Expression

Results

SELECT IsNumeric([UnitPrice]) AS Expr1 FROM ProductSales;

The function evaluates if the "UnitPrice" is a valid Number and returns the result as "-1" for True and "0" for False in the column Expr1. Result is -1 (True).

SELECT IsNumeric([DateofSale]) AS ValidNumber, IsNumeric("487.34") AS NumberTest FROM ProductSales;

The function evaluates if the "DateofSale" and "487.34" is a valid Number and returns the result as "-1" for True and "0" for False in the column ValidNumber and NumberTest respectively. Result is 0 (False) for ValidNumber and -1(True) for NumberTest.

VBA example

Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

This example uses the IsNumeric function to determine if a variable can be evaluated as a number.

Dim MyVar, MyCheckMyVar = "53"    ' Assign value.MyCheck = IsNumeric(MyVar)    ' Returns True.MyVar = "459.95"    ' Assign value.MyCheck = IsNumeric(MyVar)    ' Returns True.MyVar = "45 Help"    ' Assign value.MyCheck = IsNumeric(MyVar)    ' Returns False.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.