Combo Box Control, List Box Control, Table Fields.
You can use the ColumnWidths property to specify the width of each column in a multiple-column combo box or list box.
The ColumnWidths property holds a value specifying the width of each column in inches or centimeters, depending on the measurement system selected in the Regional Settings section of the Windows Control Panel. The default setting is 1 inch or 2.54 centimeters.
To separate your column entries, use semicolons (;) as list separators (or the list separator selected in the Regional Settings section of the Windows Control Panel).
A width of 0 hides a column. Any or all of the ColumnWidths property settings can be blank. You create a blank setting by typing a list separator without a preceding value. Blank values result in Microsoft Access automatically setting a default column width that varies depending on the number of columns and the width of the combo box or list box.
Note In a combo box, the first visible column is displayed in the text box portion of the control.
You can set the ColumnWidths property in a combo box or list boxs property sheet, a macro, or Visual Basic.
For table fields, you can set this property in table Design view for fields with the DisplayControl property set to Combo Box or List Box.
Note Microsoft Access sets this property automatically when you select Lookup Wizard as the data type for a field in table Design view.
In Visual Basic, use a string expression to set the column width value in twips. Column widths are separated by semicolons. To specify a different unit of measurement include the unit of measure. For example, the following string expression specifies three column widths in centimeters.
"6 cm;0;6 cm"
If you leave the ColumnWidths property setting blank, Microsoft Access uses the default width. If the width of the control is greater than the width of the displayed columns, Microsoft Access sets the width of each column as the overall width of the list box or combo box divided by the number of columns. If the column widths you set are too wide to be fully displayed within the combo box or list box, the rightmost columns are hidden and a horizontal scroll bar appears.
If you specify the width for some columns but leave the setting for others blank, Microsoft Access divides the remaining width by the number of columns for which you havent specified a width. The minimum calculated column width is 1,440 twips (1 inch).
For example, the following settings are applied to a 4-inch list box.
Setting | Description |
1.5 in;0;2.5 in | The first column is 1.5 inches, the second column is hidden, and the third column is 2.5 inches. |
2 in;;2 in | The first column is 2 inches, the second column is 1 inch (default), and the third column is 2 inches. Because only half of the third column is visible, a horizontal scroll bar appears. |
(Blank) | The three columns are the same width (1.33 inches). |
Note This property is different than the ColumnWidth property, which specifies the width of a specified column in a datasheet.
BoundColumn Property, ColumnCount Property, ColumnHeads Property, ColumnWidth Property, ControlSource Property, ListRows Property, ListWidth Property.