Microsoft KB Archive/221764

= PRB: IsNull and IsEmpty Always Return False on getValue When the File Is Empty or Contains Null Value =

Article ID: 221764

Article Last Modified on 9/18/2001

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q221764



SYMPTOMS
False is always returned when you call the IsNull or IsEmpty functions on the getValue method of the Visual InterDev 6.0 Recordset Design-Time Control (DTC) fields collection. This occurs when there is nothing in the field or the field is null, as in the following example: If IsNull(Recordset1.fields.getValue("fieldname")) Then Blank = True If IsEmpty(Recordset1.fields.getValue("fieldname")) Then Blank = True



CAUSE
Null and Empty are special values for variables. An empty string does not equal Empty or Null.

If the field is null or has nothing in it, the getValue method of the Recordset DTC fields collection will return an empty string regardless if the field is null or simply has no data. Thus, IsEmpty and IsNull return false.



RESOLUTION
To test for an empty field with the getValue method, compare the value to an empty string (""): If Recordset1.fields.getValue("fieldname") = "" Then Blank = True



STATUS
This behavior is by design.

Keywords: kbprb kbctrl KB221764

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.