Javatpoint Logo
Javatpoint Logo

IsNull Function in MS Access

This function checks whether the value returned or stored in an expression is equivalent to Null. The null value indicates that there is no valid data present in the expression. The function returns a Boolean value in return to the expression that is passed inside the IsNull function.

Syntax of the IsNull Function

The parameter passed in the IsNull function

The function is unary. That is, it only requires a single parameter or argument. The values returned or stored in the expression are evaluated. The expression itself can vary. It can be a numeric value or string, depending on the user.

Value Returned by IsNull

The function returns a boolean value after evaluating the expression. It can either be true or false.

True: If the function returns True for an expression, it would mean that the expression is Null.

False: And if the IsNull function returns False, it would mean that the expression is not null and constitutes at least one variable. The Null value can be assigned to any variable, returning True as the value for the entire expression.

Difference Between Null and Empty

Null is used to represent an expression that has no valid data. This is not a variable being empty. An empty variable indicates that the variable is allocated a space in the memory, but no value is stored assigned to that variable. That is, the variable has not been initialized yet. A Null value is not the same as a zero-length string (""). Some may also refer to such a string as a null string.

Note: If the user wants to implement the IsNull function, find out whether the expression contains a Null value. The expression entered as the parameter in the IsNull function is similar to IfVar=Null or IfVar<>Null. In such a case, the user may think that the value returned by the function is True. But actually, the value returned will be False instead. This is because the expression that consists of a Null is Null itself, which returns False.

Implementing IsNull Function in MS Access

Let us implement some queries expressions:

Query Expression Results
SELECT ProductID, isNull(Offer) AS Expr1 FROM ProductSales; It will return the values present in the field "ProductID" the query expression will evaluate if the values in the field "Offer" are Null. The IsNull function will return 1, that is, True, and the function will return 0 and store the result in the column titled Expression1.
SELECT ProductID, isNull(Offer) AS NullStatus FROM ProductSales; It will return the values present in the field "ProductID" the query expression will evaluate if the values in the field "Offer" are Null. The IsNull function will return 1, that is, True, and the function will return 0 and store the result in the column titled NullStatus.

Implementing IsNull Function in VBA

Not all the functions in the MS Access can be implemented in the Visual Basic Application (VBA) module. Though, we can implement the Isnull function in the VBA. Given below are some examples of implementing the IsNull function. The function will return True if the variable has a Null value.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA