How to Test for a Blank Character Variable

Last reviewed: June 27, 1995
Article ID: Q102453
The information in this article applies to:
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for MS-DOS, versions 1.01, 1.02, 2.0, 2.5x, 2.6, 2.6a
  • Microsoft FoxBASE+ for the Macintosh, version 2.01
  • Microsoft FoxBASE+ for MS-DOS, version 2.1

FoxBASE+

In FoxBASE+, to determine if a character field is blank, use the LEN() function in an IF statement, as follows:

   IF LEN(TRIM(x)) = 0    && where x is the blank memory variable

This function will also return the desired results when executed in all versions of FoxPro.

FoxPro versions 1.02 and Later

In FoxPro version 1.02 and later, the EMPTY() function may be used as follows:

   IF EMPTY(x)       && where x is still the blank memory variable

NOTE: The EMPTY() function is available only in FoxPro for MS-DOS versions 1.02 and later and in FoxPro for Windows.

FoxPro versions 2.6 and Later

In FoxPro version 2.6 and later, the ISBLANK() function may be used instead.

For information about the ISBLANK() function, refer to the FoxPro Help file or the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q99095
   TITLE     : ISBLANK() Function Provides Additional Null Value
               Support


Additional reference words: FoxDos FoxWin 2.x 2.00 2.10 2.50 2.50a 2.50b
nothing field variable foxbase+/mac
KBCategory: kbenv kbprg
KBSubcategory: FxenvMemory


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.