How to Use the TYPE() Function

Last reviewed: July 5, 1995
Article ID: Q88975
The information in this article applies to:
  • Microsoft FoxBASE+ for MS-DOS, versions 1.21 and 2.0
  • Microsoft FoxPro for MS-DOS, versions 1.0, 1.01, 1.02, 2.0, 2.5, and 2.5a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.5a

The TYPE() function returns the data type code for a specified expression. Quotation marks are required around the specified variable or field name used.

The following examples demonstrate the use of the TYPE() function:

Example 1

   x=1
   ? TYPE("x")   && returns N

Example 2

   x="TEST"
   ? TYPE("x")   && returns C

Example 3

   x=DATE()
   ? TYPE("x")   && returns D

Example 4

   x=1
   ? TYPE(x)     && returns an ERROR

Example 5

   x="TEST"
   ? TYPE(x)     && returns U

Example 4 returns an error because FoxPro tries to use x as a subscript. The last example returns U because the variable TEST does not exist.


Additional reference words: FoxWin FoxDos 1.00 1.01 1.02 1.21 2.00 2.50
2.50a
KBCategory: kbprg
KBSubcategory: FxprgGeneral


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: July 5, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.