ACC2: How to Format Data in Combo Boxes and List Boxes (120904)



The information in this article applies to:

  • Microsoft Access 2.0

This article was previously published under Q120904
Novice: Requires knowledge of the user interface on single-user computers.

SUMMARY

Microsoft Access displays data in list boxes and combo boxes whose RowSource property is set to a table or query using the format defined in the underlying fields' Format property.

If you want the data in a list box or combo box to be displayed with a different format, you can create a query and set the fields' formats using the query's Format property, or you can use the Format() function in an expression.

If a list box or combo box's RowSource property is set to an SQL statement, a field's Format property will have no affect on how the data is displayed, because SQL statements do not contain or specify any formatting information.

NOTE: In version 7.0, combo boxes have a Format property.

MORE INFORMATION

To change the format for a field in a query, follow these steps:
  1. Select the field in the query grid.
  2. From the View menu, choose Properties.
  3. Select one of the predefined formats in the Format property box, or enter an expression to format the field.
  4. Close the property sheet.
The following are examples of expressions for formatting fields in a query:
  • The expression
          format([MyDate],"dddd mmmm d, yyyy")
    						

    will display the date 1/1/94 as:
          Saturday January 1, 1994
    						

  • The expression
          format([MyNumber],"$#,##0;($#,##0)")
    						

    will display the number 1256 as
          $1,256
    						

    and will display the number -1256 as:
          ($1,256)
    						

REFERENCES

For more information about formatting data, search for "Format," and then "Formatting a Field" using the Microsoft Access Help menu.

Modification Type:MajorLast Reviewed:6/24/2002
Keywords:kbhowto kbusage KB120904