VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

IsNullEx

Jared Scarbrough  (1 Submission)   String Manipulation   Visual Basic 3.0   Intermediate   Wed 3rd February 2021

This code provides an IsNull function like that used in SQL Server. This allows you to check if a variable contains null, and if so return a specific value. This can prevent you from having to write things like iif(not isnull(rst!FieldName), rst!FieldName, ""). For new programmers, especially those working with databases, you will quickly become aware that trying to access a database field that contains a null value often results in the dreaded error #94 - Invalid Use of Null, which means you constantly have to write code to trap for that possibility.

Inputs
ValueToCheck = a variant representing he value to check for null varWhatToReturnIfNull = the value to return if ValueToCheck is null

Returns
If ValueToCheck is null, then varWhatToReturnIfNull is returned, otherwise, ValueToCheck is returned

Rate IsNullEx (11(11 Vote))
IsNullEx.bas

IsNullEx Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters