ACC: How to Get Field Data Types from a Table Using DDELast reviewed: February 6, 1998Article ID: Q102520 |
The information in this article applies to:
SUMMARYAdvanced: Requires expert coding, interoperability, and multiuser skills. The DDE FieldNames item has been enhanced in Microsoft Access 1.1 and later by adding the ability to get the field type for the field. In Microsoft Access 1.0, the FieldNames item could get the field name, but not the field type. The new item is called FieldNames;T, and can be requested on any open Microsoft Access database. Examples showing how to use this DDE feature from Microsoft Excel and Microsoft Word for Windows are listed below.
MORE INFORMATIONThe following sample Microsoft Excel macro demonstrates how to use the FieldNames;T item to get the field name and field type from the Categories table in the sample database ORDERS.MDB
Category ID Category Name Description Picture 10 10 12 11The numeric values returned describe the data type for the field. The data types are:
0 Invalid 1 True/False (non-Null) 2 Unsigned byte (Byte) 3 2-byte signed integer (Integer) 4 4-byte signed integer (Long) 5 8-byte signed integer (Currency) 6 4-byte single-precision floating-point (Single) 7 8-byte double-precision floating-point (Double) 8 Date/Time (integral date, fractional time) 9 Binary data, 255 bytes maximum 10 ANSI text, not case sensitive, 255 bytes maximum (Text) 11 Long binary (OLE Object) 12 Long text (Memo)The following example for Microsoft Word for Windows demonstrates how to use the FieldNames;T item to get the field name and field type from the Categories table in the sample database Orders.mdb:
Category ID Category Name Description Picture 10 10 12 11Some formatting of the text may be necessary to align the field type descriptor numerals under the table names. NOTE: If you see the formula you typed instead of this data, and you are using Microsoft Word 6.0, 7.0, or 97 you need to clear the Field Codes check box on the View tab by clicking Options on the Tools menu. If you are using Microsoft Word 2.0, click Field Codes on the View menu. If you are running Microsoft Word 7.0 or 97, you may see the error "!Syntax Error, MSACCESS" after clicking OK. If so, then follow these steps to correct the error:
Keywords : TblFldp kbinterop Version : 1.0 1.1 2.0 7.00 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |