ACC2: Format of Data in Text Portion of Combo Box Is Incorrect (128197)
The information in this article applies to:
This article was previously published under Q128197
Moderate: Requires basic macro, coding, and interoperability skills.
SYMPTOMS
When you select a value from a combo box list, the selection that appears
in the text portion of the combo box is not formatted as it appears in the
combo box list.
For example, if you select a date that is formatted as a Medium
Date in the table and in the combo box list (such as 10-May-91) the
date appears in the text portion of the combo box in Short Date format
(5/10/91).
CAUSE
Unlike a text box, a combo box does not have its own Format property. As a
result, if the combo box is bound to a table field, the value that appears
in the text portion of the combo box uses the format of the data as it is
stored in the table, ignoring any format defined at the table or query
level.
RESOLUTION
To correct this behavior, use the following steps to base the format for a
value in a combo box on a query rather than on a table:
- Base the combo box on a query.
- Place the field you want to make the bound column in the combo box in
both the first and second columns in the query grid.
- Place all other fields you want to include in the combo box in the
third and successive columns.
- In the combo box, make the first column the bound column and hide it
from view by setting the following properties for the combo box:
BoundColumn: 1
ColumnWidths: 0
Because the ColumnWidths property for column 1 is set to 0, Microsoft
Access uses the second column in the query to display text in the text
portion of the combo box.
In the query, you can set Format properties for the second column to
display values using the formats you want.
An example of this technique is demonstrated in the "Steps to Reproduce
Behavior" and "How to Correct the Behavior" sections later in this article.
STATUS
This behavior no longer occurs in Microsoft Access version 7.0 with the
addition of the new Format property for combo boxes.
REFERENCES
For more information about the Format property, search for "Format," and
then "Format Property" using the Microsoft Access Help menu.
Modification Type: | Major | Last Reviewed: | 7/5/2002 |
---|
Keywords: | kbprb kbusage KB128197 |
---|
|