ACC2000: How to Use the ColumnWidth Property

Article translations Article translations
Article ID: 210427 - View products that this article applies to.
This article was previously published under Q210427
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

Expand all | Collapse all

SUMMARY

This article discusses the ColumnWidth property, which applies to fields or columns in Datasheet view. This property is documented in the Microsoft Access Help index.

MORE INFORMATION

The 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 you can 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 text
				
You can also set this property by clicking the Column Width command on the Format menu 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 use Visual Basic to change a field's ColumnWidth property, the changes do 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 take effect immediately.

The following expression demonstrates how to set the ColumnWidth property for the Customers form in Datasheet view. This setting changes the Address column's width to 1.5 inches (2160 twips):
Forms![Customers]![Address].ColumnWidth = 2160

REFERENCES

For more information about the ColumnWidth property, click Microsoft Access Help on the Help menu, type columnwidth property in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

Properties

Article ID: 210427 - Last Review: July 13, 2004 - Revision: 1.3
APPLIES TO
  • Microsoft Access 2000 Standard Edition
Keywords: 
kbhowto kbprogramming KB210427

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com