ACC: How to Use the ColumnWidth PropertyLast reviewed: August 29, 1997Article ID: Q111778 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article describes the ColumnWidth property, which applies to fields or columns in Datasheet view. This property is documented in the Microsoft Access Help Index. NOTE: In Microsoft Access version 1.1, the ColumnWidth property is documented in the "The Secrets of Access Wizards" manual which is included with the Microsoft Access Distribution Kit.
MORE INFORMATIONThe ColumnWidth property applies to fields or columns in Datasheet view. It is an integer that represents the column width in twips. You can specify a width, or use one of the following predefined settings:
Setting Description ----------------------------------------------------------------- 0 Hides the column -1 Sizes the column to the default width (default setting) -2 Sizes the column to fit the visible textYou can also set this property by choosing the Column Width command from the Format menu (or Layout menu in Access 1.x) while in Datasheet view. If you set a field's ColumnWidth property to 0 to hide the field, that field's ColumnHidden property is set to -1. If you set the field's ColumnHidden property to 0 to show the field, the field's ColumnWidth property is restored to the setting it had before the field was hidden. If you hide the field by setting its ColumnWidth property to 0, the ColumnWidth property is set to -1, which is the default width. Note that the ColumnWidth property for a field is not available when the field's ColumnHidden property is set to -1. Microsoft Access evaluates the properties for a table or query in Datasheet view when the table or query is first opened in Datasheet view. If the table or query is open in Datasheet view when you change a field's ColumnWidth property using Visual Basic (or Access Basic in Microsoft Access 2.0 or earlier), the changes will not take effect until you close and then reopen the table or query in Datasheet view. The form can be open in any view, and changes to the ColumnWidth property will take effect immediately. NOTE: In Microsoft Access version 1.x, in order to change the ColumnWidth property of a field on a form, the form must be open in Design view. If the form is not open in Design view, the property is read-only. The following example demonstrates how to set the ColumnWidth property for the Customers form in Datasheet view. This setting will change the Address column's width to 1.5 inches (2160 twips):
Forms![Customers]![Address].ColumnWidth = 2160 REFERENCESFor more information about the ColumnWidth property, search the Help Index for "ColumnWidth Property," or ask the Microsoft Access 97 Office Assistant. Keywords : kbprg PgmOthr TblFldp Version : 1.0 1.1 2.0 7.0 97 Platform : WINDOWS Hardware : x86 Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |