VB and VBA Users Source Code: A simple function for removing null values
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
A simple function for removing null values
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Wednesday, May 14, 2003
Hits:
1480
Category:
Database/SQL/ADO
Article:
To prevent "Type Mismatch" errors when returning a null value from a database to a form control, use the following function to remove any null values. 'Purpose : Removes Null Values 'Inputs : vValue The value to test for a null value ' [vDefault] The value to return if null is found 'Outputs : Returns an uninitialised variant (empty) if the value ' of vValue is null, else returns the value of vValue. 'Author : Andrew Baker 'Date : 25/03/2000 'Notes : Public Function KillNull(vValue As Variant, Optional vDefault As Variant) As Variant If IsNull(vValue) = False Then KillNull = vValue Else KillNull = vDefault End If End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder