Nz Method

Microsoft Office Web Components Visual Basic

expression.Nz(Value, ValueIfNull)

expression    Required. An expression that returns a DataSourceControl object.

Value   Required Variant. The value to convert.

ValueIfNull   Optional Variant. Value to return if the Value argument argument is Null. This argument enables you to return a value other than zero or a zero-length string.

Remarks

This method is useful for expressions that may include Null values. To force an expression to evaluate to a non-Null value even when it contains a Null value, use the this method to return a zero, a zero-length string, or a custom return value.

For example, the expression 2 + varX will always return a Null value when the Variant varX is Null. However, 2 + MSODSC.Nz(varX) returns 2.

In the next example, the optional argument supplied to the Nz method provides the string to be returned if varFreight is Null.

varResult = MSODSC.Nz(varFreight, "No Freight Charge")