tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment

Other Sites

CheckYourMath BigActivities DigMinecraft
Share this page:

MS Access: Nz Function

Learn how to use the Access Nz function with syntax and examples.

Description

The Microsoft Access Nz function lets you return a value when a variant is null.

Syntax

The syntax for the Microsoft Access Nz function is:

Nz ( variant, [ value_if_null ] )

Parameters or Arguments

variant is a variable that is a variant datatype.

value_if_null is optional. It is the value to use when the variant is a null value. If this parameter is omitted and the variant is a null value, the Nz function will return a zero or a zero-length string.

Applies To

The Nz function can be used in the following versions of Microsoft Access:

Example

Nz (varName, "n/a")

The example above would return the value 'n/a' if the variable varName contained a null value.

Nz (varName)

The example above would return a zero-length string if the variable varName contained a null value.

Example (in VBA Code)

The Nz function can be used in VBA code in Microsoft Access. For example:

Dim LOption As String

LOption = Nz(varChoice, "Not Found")

In this example, the variable called LOption would now contain value in the varChoice variable unless it was a null value. If the varChoice variable contains a null value, the Nz function will return "Not Found".

Example (in SQL/Queries)

You can also use the Nz function in a query in Microsoft Access.

Microsoft Access